refactor: move OIDC client secret to non public app setting (#2558)
This commit is contained in:
+1
-1
@@ -118,7 +118,7 @@
|
||||
pSize="small"
|
||||
id="clientSecret"
|
||||
type="password"
|
||||
[(ngModel)]="oidcProvider.clientSecret"
|
||||
[(ngModel)]="oidcProviderClientSecret"
|
||||
[placeholder]="t('providerConfig.clientSecretPlaceholder')"/>
|
||||
<span class="field-hint">{{ t('providerConfig.clientSecretHint') }}</span>
|
||||
</div>
|
||||
|
||||
+10
-3
@@ -30,7 +30,6 @@ function completeProvider(overrides: Partial<OidcProviderDetails> = {}): OidcPro
|
||||
return {
|
||||
providerName: 'Example IdP',
|
||||
clientId: 'client-id',
|
||||
clientSecret: 'secret',
|
||||
issuerUri: 'https://issuer.example',
|
||||
scopes: 'openid profile email',
|
||||
claimMapping: {
|
||||
@@ -280,7 +279,11 @@ describe('AuthenticationSettingsComponent', () => {
|
||||
{
|
||||
key: AppSettingKey.OIDC_REDIRECT_URIS,
|
||||
newValue: ['grimmory://oauth2-callback', 'grimmory://auth/return'],
|
||||
}
|
||||
},
|
||||
{
|
||||
key: AppSettingKey.OIDC_PROVIDER_CLIENT_SECRET,
|
||||
newValue: "",
|
||||
},
|
||||
]);
|
||||
|
||||
component.oidcEnabled = true;
|
||||
@@ -295,10 +298,14 @@ describe('AuthenticationSettingsComponent', () => {
|
||||
key: AppSettingKey.OIDC_REDIRECT_URIS,
|
||||
newValue: ['grimmory://oauth2-callback', 'grimmory://auth/return'],
|
||||
},
|
||||
{
|
||||
key: AppSettingKey.OIDC_PROVIDER_CLIENT_SECRET,
|
||||
newValue: "",
|
||||
},
|
||||
{
|
||||
key: AppSettingKey.OIDC_SESSION_DURATION_HOURS,
|
||||
newValue: 24,
|
||||
}
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
+8
-2
@@ -113,10 +113,11 @@ export class AuthenticationSettingsComponent {
|
||||
readonly groupMappings = signal<OidcGroupMapping[]>([]);
|
||||
readonly groupMappingDraft = signal<OidcGroupMapping | null>(null);
|
||||
|
||||
oidcProviderClientSecret: string = '';
|
||||
|
||||
oidcProvider: OidcProviderDetails = {
|
||||
providerName: '',
|
||||
clientId: '',
|
||||
clientSecret: '',
|
||||
issuerUri: '',
|
||||
scopes: '',
|
||||
claimMapping: {
|
||||
@@ -172,9 +173,10 @@ export class AuthenticationSettingsComponent {
|
||||
issuerUri: settings.oidcProviderDetails?.issuerUri || '',
|
||||
scopes: settings.oidcProviderDetails?.scopes || '',
|
||||
claimMapping: settings.oidcProviderDetails?.claimMapping || defaultClaimMapping,
|
||||
clientSecret: settings.oidcProviderDetails?.clientSecret || '',
|
||||
};
|
||||
|
||||
this.oidcProviderClientSecret = settings.oidcProviderClientSecret || '';
|
||||
|
||||
this.availablePermissions.forEach(perm => {
|
||||
perm.selected = this.selectedPermissions.includes(perm.value);
|
||||
});
|
||||
@@ -216,6 +218,10 @@ export class AuthenticationSettingsComponent {
|
||||
{
|
||||
key: AppSettingKey.OIDC_REDIRECT_URIS,
|
||||
newValue: this.mobileRedirectUris
|
||||
},
|
||||
{
|
||||
key: AppSettingKey.OIDC_PROVIDER_CLIENT_SECRET,
|
||||
newValue: this.oidcProviderClientSecret
|
||||
}
|
||||
];
|
||||
if (this.oidcEnabled) {
|
||||
|
||||
@@ -33,7 +33,6 @@ export interface MetadataMatchWeights {
|
||||
export interface OidcProviderDetails {
|
||||
providerName: string;
|
||||
clientId: string;
|
||||
clientSecret?: string;
|
||||
issuerUri: string;
|
||||
scopes?: string;
|
||||
claimMapping: {
|
||||
@@ -185,6 +184,7 @@ export interface AppSettings {
|
||||
remoteAuthEnabled: boolean;
|
||||
oidcEnabled: boolean;
|
||||
oidcProviderDetails: OidcProviderDetails;
|
||||
oidcProviderClientSecret: string | null;
|
||||
oidcRedirectUris: string[];
|
||||
oidcAutoProvisionDetails: OidcAutoProvisionDetails;
|
||||
maxFileUploadSizeInMb: number;
|
||||
@@ -235,6 +235,7 @@ export enum AppSettingKey {
|
||||
KOMGA_GROUP_UNKNOWN = 'KOMGA_GROUP_UNKNOWN',
|
||||
OIDC_ENABLED = 'OIDC_ENABLED',
|
||||
OIDC_PROVIDER_DETAILS = 'OIDC_PROVIDER_DETAILS',
|
||||
OIDC_PROVIDER_CLIENT_SECRET = 'OIDC_PROVIDER_CLIENT_SECRET',
|
||||
OIDC_REDIRECT_URIS = 'OIDC_REDIRECT_URIS',
|
||||
OIDC_AUTO_PROVISION_DETAILS = 'OIDC_AUTO_PROVISION_DETAILS',
|
||||
MAX_FILE_UPLOAD_SIZE_IN_MB = 'MAX_FILE_UPLOAD_SIZE_IN_MB',
|
||||
|
||||
@@ -43,6 +43,7 @@ function buildAppSettings(overrides: Partial<AppSettings> = {}): AppSettings {
|
||||
remoteAuthEnabled: publicSettings.remoteAuthEnabled,
|
||||
oidcEnabled: publicSettings.oidcEnabled,
|
||||
oidcProviderDetails: publicSettings.oidcProviderDetails,
|
||||
oidcProviderClientSecret: null,
|
||||
oidcRedirectUris: ['grimmory://oauth2-callback'],
|
||||
oidcAutoProvisionDetails: {
|
||||
enableAutoProvisioning: false,
|
||||
|
||||
Reference in New Issue
Block a user