-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: configure auth server when configuring environment (#191)
- Loading branch information
1 parent
790a22f
commit 692bb1b
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { OpenIdClient } from '@user-office-software/openid'; | ||
import { container } from 'tsyringe'; | ||
|
||
import { AdminDataSource } from '../datasources/AdminDataSource'; | ||
import { SettingsId } from '../models/Settings'; | ||
import { Tokens } from './Tokens'; | ||
|
||
export async function updateOIDCSettings() { | ||
if (OpenIdClient.hasConfig() === false) { | ||
return; | ||
} | ||
|
||
const loginUrl = await OpenIdClient.loginUrl(); | ||
const logoutUrl = await OpenIdClient.logoutUrl(); | ||
const db = container.resolve<AdminDataSource>(Tokens.AdminDataSource); | ||
|
||
await db.updateSettings({ | ||
settingsId: SettingsId.EXTERNAL_AUTH_LOGIN_URL, | ||
settingsValue: loginUrl, | ||
}); | ||
|
||
await db.updateSettings({ | ||
settingsId: SettingsId.EXTERNAL_AUTH_LOGOUT_URL, | ||
settingsValue: logoutUrl, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters