Skip to content

Commit

Permalink
Move SSO URLs to environment variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhamez committed Apr 1, 2024
1 parent e911d42 commit e8b72a5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Replace all values with your configuration.
SSO_CLIENT_ID="the Eve application's client ID" \
SSO_CLIENT_SECRET="the Eve application's secret key" \
SSO_REDIRECT_URI="the Eve application's callback URL" \
SSO_TOKEN_URI="https://login.eveonline.com/v2/oauth/token" \
SSO_AUTHORIZATION_URI="https://login.eveonline.com/v2/oauth/authorize/" \
SLACK_TOKEN="the Slack App's Bot User OAuth Token" \
CORE_URL="the URL where your Neucore instance can be reached by the backend" \
CORE_APP_ID="the Neucore app's numerical ID" \
Expand Down Expand Up @@ -110,6 +112,8 @@ DB_URL="your database connection string" \
SSO_CLIENT_ID="the Eve application's client ID" \
SSO_CLIENT_SECRET="the Eve application's secret key" \
SSO_REDIRECT_URI="the Eve application's callback URL" \
SSO_TOKEN_URI="https://login.eveonline.com/v2/oauth/token" \
SSO_AUTHORIZATION_URI="https://login.eveonline.com/v2/oauth/authorize/" \
SLACK_TOKEN="the Slack App's Bot User OAuth Token" \
CORE_URL="the URL where your Neucore instance can be reached by the backend" \
CORE_APP_ID="the Neucore app's numerical ID" \
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ services:
SSO_CLIENT_ID:
SSO_CLIENT_SECRET:
SSO_REDIRECT_URI: "http://localhost:3000/auth/callback"
SSO_TOKEN_URI: "https://login.eveonline.com/v2/oauth/token"
SSO_AUTHORIZATION_URI: "https://login.eveonline.com/v2/oauth/authorize/"
SLACK_TOKEN:
CORE_URL:
CORE_APP_ID:
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ SSO_CLIENT_SECRET
# if you mount the application behind a reverse proxy and under a subpath, it
# may also be something like https://example.com/pingboard/auth/callback.
SSO_REDIRECT_URI
# https://login.eveonline.com/v2/oauth/token
SSO_TOKEN_URI
# https://login.eveonline.com/v2/oauth/authorize/
SSO_AUTHORIZATION_URI
```

### Slack configuration
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ async function main() {
clientId: getFromEnv('SSO_CLIENT_ID'),
clientSecret: getFromEnv('SSO_CLIENT_SECRET'),
redirectUri: getFromEnv('SSO_REDIRECT_URI'),
accessTokenUri: getFromEnv('SSO_TOKEN_URI'),
authorizationUri: getFromEnv('SSO_AUTHORIZATION_URI'),
})
eveSsoClient.startAutoCleanup()

Expand Down
8 changes: 6 additions & 2 deletions packages/backend/src/sso/eve-sso-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export interface EveSSOClientConfig {
/** The Callback URL configured on https://developers.eveonline.com/ */
redirectUri: string

/** OAuth URLs/ */
accessTokenUri: string
authorizationUri: string

/**
* Time in seconds after which OAuth2 login states expire.
* Defaults to 5 minutes.
Expand Down Expand Up @@ -45,8 +49,8 @@ export class EveSSOClient {
clientId: options.clientId,
clientSecret: options.clientSecret,
redirectUri: options.redirectUri,
accessTokenUri: 'https://login.eveonline.com/v2/oauth/token',
authorizationUri: 'https://login.eveonline.com/v2/oauth/authorize/',
accessTokenUri: options.accessTokenUri,
authorizationUri: options.authorizationUri,
})

this.stateTimeout = options.stateTimeout ?? 300
Expand Down

0 comments on commit e8b72a5

Please sign in to comment.