Skip to content

Commit c81d7f0

Browse files
kelsinChristopher Giroirtim-lai
authoredMar 21, 2022
feat(docker): add OAUTH_USE_BASIC_AUTH env (#7474)
Makes the last `initOAuth` variable configurable via environment variables in the swagger-ui docker image. Co-authored-by: Christopher Giroir <chrisgiroir@improbable.io> Co-authored-by: Tim Lai <timothy.lai@gmail.com>
1 parent bd19c9c commit c81d7f0

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed
 

‎dev-helpers/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
scopeSeparator: " ",
6060
scopes: "openid profile email phone address",
6161
additionalQueryStringParams: {},
62+
useBasicAuthenticationWithAccessCodeGrant: false,
6263
usePkceWithAuthorizationCodeGrant: false
6364
})
6465
}

‎docker/configurator/oauth.js

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ const oauthBlockSchema = {
3131
type: "object",
3232
name: "additionalQueryStringParams"
3333
},
34+
OAUTH_USE_BASIC_AUTH: {
35+
type: "boolean",
36+
name: "useBasicAuthenticationWithAccessCodeGrant"
37+
},
3438
OAUTH_USE_PKCE: {
3539
type: "boolean",
3640
name: "usePkceWithAuthorizationCodeGrant"

‎docs/usage/oauth2.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ appName | `OAUTH_APP_NAME` |application name, displayed in authorization popup.
1010
scopeSeparator | `OAUTH_SCOPE_SEPARATOR` |scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
1111
scopes | `OAUTH_SCOPES` |string array or scope separator (i.e. space) separated string of initially selected oauth scopes, default is empty array
1212
additionalQueryStringParams | `OAUTH_ADDITIONAL_PARAMS` |Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
13-
useBasicAuthenticationWithAccessCodeGrant | _Unavailable_ |Only activated for the `accessCode` flow. During the `authorization_code` request to the `tokenUrl`, pass the [Client Password](https://tools.ietf.org/html/rfc6749#section-2.3.1) using the HTTP Basic Authentication scheme (`Authorization` header with `Basic base64encode(client_id + client_secret)`). The default is `false`
13+
useBasicAuthenticationWithAccessCodeGrant | `OAUTH_USE_BASIC_AUTH` |Only activated for the `accessCode` flow. During the `authorization_code` request to the `tokenUrl`, pass the [Client Password](https://tools.ietf.org/html/rfc6749#section-2.3.1) using the HTTP Basic Authentication scheme (`Authorization` header with `Basic base64encode(client_id + client_secret)`). The default is `false`
1414
usePkceWithAuthorizationCodeGrant | `OAUTH_USE_PKCE` | Only applies to `authorizatonCode` flows. [Proof Key for Code Exchange](https://tools.ietf.org/html/rfc7636) brings enhanced security for OAuth public clients. The default is `false`
1515

1616
```javascript
@@ -25,6 +25,7 @@ ui.initOAuth({
2525
scopeSeparator: " ",
2626
scopes: "openid profile",
2727
additionalQueryStringParams: {test: "hello"},
28+
useBasicAuthenticationWithAccessCodeGrant: true,
2829
usePkceWithAuthorizationCodeGrant: true
2930
})
3031
```

‎test/unit/docker/oauth.js

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe("docker: env translator - oauth block", function() {
2222
OAUTH_APP_NAME: ``,
2323
OAUTH_SCOPE_SEPARATOR: "",
2424
OAUTH_ADDITIONAL_PARAMS: ``,
25+
OAUTH_USE_BASIC_AUTH: false,
2526
OAUTH_USE_PKCE: false
2627
}
2728

@@ -33,6 +34,7 @@ describe("docker: env translator - oauth block", function() {
3334
appName: "",
3435
scopeSeparator: "",
3536
additionalQueryStringParams: undefined,
37+
useBasicAuthenticationWithAccessCodeGrant: false,
3638
usePkceWithAuthorizationCodeGrant: false,
3739
})`))
3840
})
@@ -45,6 +47,7 @@ describe("docker: env translator - oauth block", function() {
4547
OAUTH_APP_NAME: `myAppName`,
4648
OAUTH_SCOPE_SEPARATOR: "%21",
4749
OAUTH_ADDITIONAL_PARAMS: `{ "a": 1234, "b": "stuff" }`,
50+
OAUTH_USE_BASIC_AUTH: true,
4851
OAUTH_USE_PKCE: true
4952
}
5053

@@ -56,6 +59,7 @@ describe("docker: env translator - oauth block", function() {
5659
appName: "myAppName",
5760
scopeSeparator: "%21",
5861
additionalQueryStringParams: { "a": 1234, "b": "stuff" },
62+
useBasicAuthenticationWithAccessCodeGrant: true,
5963
usePkceWithAuthorizationCodeGrant: true,
6064
})`))
6165
})

0 commit comments

Comments
 (0)
Please sign in to comment.