mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-25 18:10:50 +00:00

* show app redirect issues, action layout * refactor pagination * tos, privacy * new paginator everywhere * layout width and table optim * lint pt1 * lint config, ts * stylelint * chore(deps-dev): bump @angular/cli from 11.2.7 to 11.2.8 in /console (#1566) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular/cli from 11.2.7 to 11.2.8 in /console Bumps [@angular/cli](https://github.com/angular/angular-cli) from 11.2.7 to 11.2.8. - [Release notes](https://github.com/angular/angular-cli/releases) - [Commits](https://github.com/angular/angular-cli/compare/v11.2.7...v11.2.8) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump jasmine-spec-reporter from 6.0.0 to 7.0.0 in /console (#1573) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump jasmine-spec-reporter in /console Bumps [jasmine-spec-reporter](https://github.com/bcaudan/jasmine-spec-reporter) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/bcaudan/jasmine-spec-reporter/releases) - [Changelog](https://github.com/bcaudan/jasmine-spec-reporter/blob/master/CHANGELOG.md) - [Commits](https://github.com/bcaudan/jasmine-spec-reporter/compare/v6.0.0...v7.0.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @angular-devkit/build-angular from 0.1102.7 to 0.1102.8 in /console (#1574) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular-devkit/build-angular in /console Bumps [@angular-devkit/build-angular](https://github.com/angular/angular-cli) from 0.1102.7 to 0.1102.8. - [Release notes](https://github.com/angular/angular-cli/releases) - [Commits](https://github.com/angular/angular-cli/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <max@caos.ch> * chore(deps): bump @types/file-saver from 2.0.1 to 2.0.2 in /console (#1576) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps): bump @types/file-saver from 2.0.1 to 2.0.2 in /console Bumps [@types/file-saver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/file-saver) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/file-saver) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @angular/language-service from 11.2.8 to 11.2.9 in /console (#1567) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular/language-service in /console Bumps [@angular/language-service](https://github.com/angular/angular/tree/HEAD/packages/language-service) from 11.2.8 to 11.2.9. - [Release notes](https://github.com/angular/angular/releases) - [Changelog](https://github.com/angular/angular/blob/master/CHANGELOG.md) - [Commits](https://github.com/angular/angular/commits/11.2.9/packages/language-service) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update protobuf, libphone * chore(deps): bump rxjs from 6.6.3 to 6.6.7 in /console (#1488) Bumps [rxjs](https://github.com/reactivex/rxjs) from 6.6.3 to 6.6.7. - [Release notes](https://github.com/reactivex/rxjs/releases) - [Changelog](https://github.com/ReactiveX/rxjs/blob/6.6.7/CHANGELOG.md) - [Commits](https://github.com/reactivex/rxjs/compare/6.6.3...6.6.7) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @types/jasmine from 3.6.3 to 3.6.9 in /console (#1485) Bumps [@types/jasmine](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jasmine) from 3.6.3 to 3.6.9. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jasmine) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <max@caos.ch> * chore(deps-dev): bump jasmine-core from 3.6.0 to 3.7.1 in /console (#1445) Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 3.6.0 to 3.7.1. - [Release notes](https://github.com/jasmine/jasmine/releases) - [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md) - [Commits](https://github.com/jasmine/jasmine/compare/v3.6.0...v3.7.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
238 lines
8.7 KiB
TypeScript
238 lines
8.7 KiB
TypeScript
import { RadioItemAuthType } from 'src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component';
|
|
import {
|
|
APIAuthMethodType,
|
|
APIConfig,
|
|
OIDCAuthMethodType,
|
|
OIDCConfig,
|
|
OIDCGrantType,
|
|
OIDCResponseType,
|
|
} from 'src/app/proto/generated/zitadel/app_pb';
|
|
|
|
export const CODE_METHOD: RadioItemAuthType = {
|
|
key: 'CODE',
|
|
titleI18nKey: 'APP.AUTHMETHODS.CODE.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.CODE.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'CODE',
|
|
background: 'rgb(89 115 128)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_CODE,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_BASIC,
|
|
recommended: false,
|
|
};
|
|
export const PKCE_METHOD: RadioItemAuthType = {
|
|
key: 'PKCE',
|
|
titleI18nKey: 'APP.AUTHMETHODS.PKCE.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.PKCE.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'PKCE',
|
|
background: 'rgb(80 110 92)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_CODE,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
recommended: true,
|
|
};
|
|
export const POST_METHOD: RadioItemAuthType = {
|
|
key: 'POST',
|
|
titleI18nKey: 'APP.AUTHMETHODS.POST.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.POST.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'POST',
|
|
background: 'rgb(144 75 75)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_CODE,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_POST,
|
|
notRecommended: true,
|
|
};
|
|
export const PK_JWT_METHOD: RadioItemAuthType = {
|
|
key: 'PK_JWT',
|
|
titleI18nKey: 'APP.AUTHMETHODS.PK_JWT.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.PK_JWT.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'JWT',
|
|
background: 'rgb(89, 93, 128)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_CODE,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
apiAuthMethod: APIAuthMethodType.API_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
// recommended: true,
|
|
};
|
|
export const BASIC_AUTH_METHOD: RadioItemAuthType = {
|
|
key: 'BASIC',
|
|
titleI18nKey: 'APP.AUTHMETHODS.BASIC.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.BASIC.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'BASIC',
|
|
background: 'rgb(144 75 75)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_CODE,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_POST,
|
|
apiAuthMethod: APIAuthMethodType.API_AUTH_METHOD_TYPE_BASIC,
|
|
};
|
|
|
|
export const IMPLICIT_METHOD: RadioItemAuthType = {
|
|
key: 'IMPLICIT',
|
|
titleI18nKey: 'APP.AUTHMETHODS.IMPLICIT.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.IMPLICIT.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'IMP',
|
|
background: 'rgb(144 75 75)',
|
|
responseType: OIDCResponseType.OIDC_RESPONSE_TYPE_ID_TOKEN,
|
|
grantType: OIDCGrantType.OIDC_GRANT_TYPE_IMPLICIT,
|
|
authMethod: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
notRecommended: true,
|
|
};
|
|
|
|
export const CUSTOM_METHOD: RadioItemAuthType = {
|
|
key: 'CUSTOM',
|
|
titleI18nKey: 'APP.AUTHMETHODS.CUSTOM.TITLE',
|
|
descI18nKey: 'APP.AUTHMETHODS.CUSTOM.DESCRIPTION',
|
|
disabled: false,
|
|
prefix: 'CUSTOM',
|
|
background: '#333',
|
|
};
|
|
|
|
export function getPartialConfigFromAuthMethod(authMethod: string): {
|
|
oidc?: Partial<OIDCConfig.AsObject>;
|
|
api?: Partial<APIConfig.AsObject>;
|
|
} | undefined {
|
|
let config: {
|
|
oidc?: Partial<OIDCConfig.AsObject>,
|
|
api?: Partial<APIConfig.AsObject>,
|
|
};
|
|
switch (authMethod) {
|
|
case CODE_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
responseTypesList: [OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
grantTypesList: [OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_BASIC,
|
|
},
|
|
};
|
|
return config;
|
|
case PKCE_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
responseTypesList: [OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
grantTypesList: [OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
},
|
|
};
|
|
return config;
|
|
case POST_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
responseTypesList: [OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
grantTypesList: [OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_POST,
|
|
},
|
|
};
|
|
return config;
|
|
case PK_JWT_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
responseTypesList: [OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
grantTypesList: [OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
},
|
|
api: {
|
|
authMethodType: APIAuthMethodType.API_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
},
|
|
};
|
|
return config;
|
|
case BASIC_AUTH_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_BASIC,
|
|
},
|
|
api: {
|
|
authMethodType: APIAuthMethodType.API_AUTH_METHOD_TYPE_BASIC,
|
|
},
|
|
};
|
|
return config;
|
|
case IMPLICIT_METHOD.key:
|
|
config = {
|
|
oidc: {
|
|
responseTypesList: [OIDCResponseType.OIDC_RESPONSE_TYPE_ID_TOKEN_TOKEN],
|
|
grantTypesList: [OIDCGrantType.OIDC_GRANT_TYPE_IMPLICIT],
|
|
authMethodType: OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
},
|
|
api: {
|
|
authMethodType: APIAuthMethodType.API_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
},
|
|
};
|
|
return config;
|
|
default:
|
|
return undefined;
|
|
}
|
|
}
|
|
|
|
export function getAuthMethodFromPartialConfig(
|
|
config: {
|
|
oidc?: Partial<OIDCConfig.AsObject>,
|
|
api?: Partial<APIConfig.AsObject>,
|
|
},
|
|
): string {
|
|
if (config?.oidc) {
|
|
const toCheck = [config.oidc.responseTypesList, config.oidc.grantTypesList, config.oidc.authMethodType];
|
|
const code = JSON.stringify(
|
|
[
|
|
[OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
[OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_BASIC,
|
|
],
|
|
);
|
|
|
|
const pkce = JSON.stringify(
|
|
[
|
|
[OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
[OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
],
|
|
);
|
|
|
|
const post = JSON.stringify(
|
|
[
|
|
[OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
[OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_POST,
|
|
],
|
|
);
|
|
|
|
const pkjwt = JSON.stringify(
|
|
[
|
|
[OIDCResponseType.OIDC_RESPONSE_TYPE_CODE],
|
|
[OIDCGrantType.OIDC_GRANT_TYPE_AUTHORIZATION_CODE],
|
|
OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT,
|
|
],
|
|
);
|
|
|
|
const implicit = JSON.stringify(
|
|
[
|
|
[OIDCResponseType.OIDC_RESPONSE_TYPE_ID_TOKEN_TOKEN],
|
|
[OIDCGrantType.OIDC_GRANT_TYPE_IMPLICIT],
|
|
OIDCAuthMethodType.OIDC_AUTH_METHOD_TYPE_NONE,
|
|
],
|
|
);
|
|
|
|
switch (JSON.stringify(toCheck)) {
|
|
case code: return CODE_METHOD.key;
|
|
case pkce: return PKCE_METHOD.key;
|
|
case post: return POST_METHOD.key;
|
|
case pkjwt: return PK_JWT_METHOD.key;
|
|
case implicit: return IMPLICIT_METHOD.key;
|
|
default:
|
|
return CUSTOM_METHOD.key;
|
|
}
|
|
} else if (config.api && config.api.authMethodType !== undefined) {
|
|
switch (config.api.authMethodType.toString()) {
|
|
case APIAuthMethodType.API_AUTH_METHOD_TYPE_PRIVATE_KEY_JWT.toString(): return PK_JWT_METHOD.key;
|
|
case APIAuthMethodType.API_AUTH_METHOD_TYPE_BASIC.toString(): return BASIC_AUTH_METHOD.key;
|
|
default:
|
|
return CUSTOM_METHOD.key;
|
|
}
|
|
} else {
|
|
return CUSTOM_METHOD.key;
|
|
}
|
|
}
|