Skip to content

Commit 37c7ca8

Browse files
committed
Explain environment variables for OAuth 2.0 login in .env.example
1 parent a8413c1 commit 37c7ca8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.env.example

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,29 @@
3535
# Can be generated with e.g. pwgen -s 64 1
3636
# Please provide a string of length 64+ characters
3737
# SESSION_SECRET=
38+
39+
# Enable login with OAuth 2.0
40+
# OAUTH2_ENABLED: false
41+
# OAUTH2_CLIENT_ID: ctfnote
42+
# OAUTH2_CLIENT_SECRET: insecure_secret
43+
# OAUTH2_SCOPE: openid profile groups
44+
45+
# The attribute to use as login and username
46+
# OAUTH2_USERNAME_ATTR: name
47+
48+
# The attribute to use for determining the user's role
49+
# The attribute can either be a string or an array of strings
50+
# In case of an array, the highest role will be selected
51+
# OAUTH2_ROLE_ATTR: groups
52+
53+
# A mapping for the values of the attribute to roles in CTFNote
54+
# roles: user_admin, user_manager, user_member, user_fried, user_guest, none (no access to CTFNote)
55+
# OAUTH2_ROLE_MAPPING: '{"ctf0_admin": "user_member"}'
56+
57+
# Either specify the discovery url or all other properties
58+
# If a discovery url is provided, the other properties overwrite the values from the discovery
59+
# OAUTH2_DISCOVERY_URL: https://example.com/.well-known/openid-configuration
60+
# OAUTH2_ISSUER: https://example.com
61+
# OAUTH2_AUTHORIZATION_ENDPOINT: https://example.com/api/oidc/authorization
62+
# OAUTH2_TOKEN_ENDPOINT: https://example.com/api/oidc/token
63+
# OAUTH2_USERINFO_ENDPOINT: https://example.com/api/oidc/userinfo

api/src/plugins/loginWithOAuth2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function checkOAuth2Enabled() {
5959
config.oauth2.tokenEndpoint || discoveryJson.token_endpoint,
6060
userinfoEndpoint:
6161
config.oauth2.userinfoEndpoint || discoveryJson.userinfo_endpoint,
62-
issuer: discoveryJson.issuer || config.oauth2.issuer,
62+
issuer: config.oauth2.issuer || discoveryJson.issuer,
6363
};
6464
} catch (error) {
6565
console.error(`Failed to fetch ${config.oauth2.discoveryUrl}:`, error);

0 commit comments

Comments
 (0)