Skip to content

Commit f5e1611

Browse files
authored
Merge pull request #104 from vidispine/fixes-1.29
explicit auth type selection
2 parents 6b51db0 + c667b7b commit f5e1611

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

hull-vidispine-addon/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ apiVersion: v1
33
appVersion: 1.29.0
44
description: hull-vidispine-addon
55
name: hull-vidispine-addon
6-
version: 1.29.1
6+
version: 1.29.2

hull-vidispine-addon/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ Describes an endpoint which is communicated with. <br>Has exclusively the follow
7070
| Parameter | Description | Defaults | Example |
7171
| ------------------------------- | ----------------------------------------------------------------| -----------------------------| -----------------------------------------|
7272
| `endpoint` | The HTTP/HTTPS path to the endpoint API <br><br>If this is not defined, nothing will be attempted to be written to this endpoint | | `https://vpms3testsystem.westeurope.cloudapp.azure.com:19081/Authentication/Core`<br>or<br>`http://dv-ndr-plat4.s4m.de:31060`
73-
| `auth` | Defines how to authenticate at the given endpoint<br><br>Has one of following keys:<br>`basic`<br>`token`<br>`session` |
73+
| `auth` | Defines how to authenticate at the given endpoint<br><br>Has one of following keys:<br>`type`<br>`basic`<br>`token`<br>`session` |
74+
| `auth.type` | Defines the explicit type of authentication to use, must be either `session`, `token` or `basic`. If not set the first defined authentication method is used. | | `type:`&#160;`basic`
7475
| `auth.basic` | Defines basic authentication for connecting to API | | `env:`<br>&#160;&#160;`username:`&#160;`VIDICORE_ADMIN_USERNAME`<br>&#160;&#160;`password:`&#160;`VIDICORE_ADMIN_PASSWORD`
7576
| `auth.basic.env.username` | Defines the environment variable that holds the username for basic auth.<br><br>Note:<br>If the `username` to be used is not contained in the automatically created `auth` or pod specific secret, the secret holding the `username` must be mounted to the container to populate the `username` environment variable
7677
| `auth.basic.env.password` | Defines the environment variable that holds the password for basic auth.<br><br>Note:<br>If the `password` to be used is not contained in the automatically created `auth` or pod specific secret, the secret holding the `password` must be mounted to the container to populate the `password` environment variable

hull-vidispine-addon/hull-vidispine-addon.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ hull:
152152
body:
153153
client_id: $env:CLIENT_CONFIGPORTAL_INSTALLATION_ID
154154
client_secret: $env:CLIENT_CONFIGPORTAL_INSTALLATION_SECRET
155-
grantType: client_credentials
155+
grant_type: client_credentials
156156
scope: 'configportalscope'
157157
headers:
158158
Content-Type: "application/x-www-form-urlencoded"
@@ -1272,9 +1272,20 @@ hull:
12721272
# Set ContentType Header always
12731273
$headers.Add("Content-Type", $contentType)
12741274
$headers.Add("Accept", $contentType)
1275-
12761275
$authHeader = [String]::Empty
1277-
if ($null -ne $auth.session)
1276+
1277+
$explicitAuthType = $false
1278+
if ($null -ne $auth.type)
1279+
{
1280+
$this.WriteLog("++++ Auth type is explicitly set to '$($auth.type)'")
1281+
$explicitAuthType = $true
1282+
}
1283+
else
1284+
{
1285+
$this.WriteLog("++++ No explitit auth type is set, selecting first one defined.")
1286+
}
1287+
1288+
if ($null -ne $auth.session -and (-not $explicitAuthType -or ($explicitAuthType -and $auth.type -eq "session")))
12781289
{
12791290
if ($null -ne $this._sessionCookies)
12801291
{
@@ -1286,12 +1297,12 @@ hull:
12861297
$this.GetAccess($auth.session, "session")
12871298
}
12881299
}
1289-
if ($null -ne $auth.token)
1300+
if ($null -ne $auth.token -and (-not $explicitAuthType -or ($explicitAuthType -and $auth.type -eq "token")))
12901301
{
12911302
$accessToken = $this.GetAccess($auth.token, "token")
12921303
$authHeader = "Bearer $accessToken"
12931304
}
1294-
if ($null -ne $auth.basic)
1305+
if ($null -ne $auth.basic -and (-not $explicitAuthType -or ($explicitAuthType -and $auth.type -eq "basic")))
12951306
{
12961307
$authHeader = "Basic $([Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes([environment]::GetEnvironmentVariable($auth.basic.env.username,"Process") + ":" + [environment]::GetEnvironmentVariable($auth.basic.env.password,"Process"))))"
12971308
$this.WriteLog("++++ Using Basic Auth for User '$([Text.Encoding]::ASCII.GetBytes([environment]::GetEnvironmentVariable($auth.basic.env.username,"Process")))'. Password is $(if ([environment]::GetEnvironmentVariable($auth.basic.env.password,"Process") -ne [String]::Empty) {"not "} else {" "} )empty.")

0 commit comments

Comments
 (0)