mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-08 04:32:13 +00:00
feat(console): organization overview table, table, org context filtering, fix grpc error log, cleanup pipes (#796)
* chore(deps-dev): bump @angular/cli from 10.0.8 to 10.1.3 in /console (#785) Bumps [@angular/cli](https://github.com/angular/angular-cli) from 10.0.8 to 10.1.3. - [Release notes](https://github.com/angular/angular-cli/releases) - [Commits](https://github.com/angular/angular-cli/compare/v10.0.8...v10.1.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @angular-devkit/build-angular in /console (#784) Bumps [@angular-devkit/build-angular](https://github.com/angular/angular-cli) from 0.1000.8 to 0.1001.3. - [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: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <max@caos.ch> * chore(deps-dev): bump @angular/language-service in /console (#783) Bumps [@angular/language-service](https://github.com/angular/angular/tree/HEAD/packages/language-service) from 10.1.0 to 10.1.3. - [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/10.1.3/packages/language-service) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump stylelint from 13.7.1 to 13.7.2 in /console (#782) Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.7.1 to 13.7.2. - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/13.7.1...13.7.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump karma from 5.2.1 to 5.2.3 in /console (#781) Bumps [karma](https://github.com/karma-runner/karma) from 5.2.1 to 5.2.3. - [Release notes](https://github.com/karma-runner/karma/releases) - [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md) - [Commits](https://github.com/karma-runner/karma/compare/v5.2.1...v5.2.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump moment from 2.27.0 to 2.29.0 in /console (#780) Bumps [moment](https://github.com/moment/moment) from 2.27.0 to 2.29.0. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](https://github.com/moment/moment/compare/2.27.0...2.29.0) 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/node from 14.6.4 to 14.11.2 in /console (#778) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.4 to 14.11.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump prettier from 2.1.1 to 2.1.2 in /console (#757) Bumps [prettier](https://github.com/prettier/prettier) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.1...2.1.2) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump ts-protoc-gen from 0.12.0 to 0.13.0 in /console (#737) Bumps [ts-protoc-gen](https://github.com/improbable-eng/ts-protoc-gen) from 0.12.0 to 0.13.0. - [Release notes](https://github.com/improbable-eng/ts-protoc-gen/releases) - [Changelog](https://github.com/improbable-eng/ts-protoc-gen/blob/master/CHANGELOG.md) - [Commits](https://github.com/improbable-eng/ts-protoc-gen/compare/0.12.0...0.13.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump jasmine-spec-reporter in /console (#762) Bumps [jasmine-spec-reporter](https://github.com/bcaudan/jasmine-spec-reporter) from 5.0.2 to 6.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/v5.0.2...v6.0.0) 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> * fix: package * change html lang to translation lang * disable detail view org idp * catch errorcode 16 in auth response interceptor * new icons * refactor pipes, idp table config * fix router guard * lint * allowed commonjs deps * Update console/src/assets/i18n/en.json Co-authored-by: Florian Forster <florian@caos.ch> * Update console/src/assets/i18n/de.json Co-authored-by: Florian Forster <florian@caos.ch> * clear table warning * org overview table, header filter * toolbar filter * user table filter * fix org filter themed color, reject error * org context filter * button cleanup * commonjs deps, remove a11y module * replace progressbar with spinner * dynamic user, org filter * ts lint, scss lint * cleanup table, row highlighting * lint * fix i18n description, refresh idp list in login p * remove async from grpc services, fix external idp * remove external idp * fix theme toggle * change iam policy header i18n * sticky action columns * lint * add i18n filter to user, remove unused org code Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Florian Forster <florian@caos.ch>
This commit is contained in:
@@ -37,8 +37,8 @@ import {
|
||||
ViewID,
|
||||
Views,
|
||||
} from '../proto/generated/admin_pb';
|
||||
import { IdpUpdate } from '../proto/generated/management_pb';
|
||||
import { GrpcService } from './grpc.service';
|
||||
import {IdpUpdate} from '../proto/generated/management_pb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -46,7 +46,7 @@ import {IdpUpdate} from '../proto/generated/management_pb';
|
||||
export class AdminService {
|
||||
constructor(private readonly grpcService: GrpcService) { }
|
||||
|
||||
public async SetUpOrg(
|
||||
public SetUpOrg(
|
||||
createOrgRequest: CreateOrgRequest,
|
||||
humanRequest: CreateHumanRequest,
|
||||
): Promise<OrgSetUpResponse> {
|
||||
@@ -61,29 +61,29 @@ export class AdminService {
|
||||
return this.grpcService.admin.setUpOrg(req);
|
||||
}
|
||||
|
||||
public async GetIamMemberRoles(): Promise<IamMemberRoles> {
|
||||
public GetIamMemberRoles(): Promise<IamMemberRoles> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getIamMemberRoles(req);
|
||||
}
|
||||
|
||||
public async GetViews(): Promise<Views> {
|
||||
public GetViews(): Promise<Views> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getViews(req);
|
||||
}
|
||||
|
||||
public async GetFailedEvents(): Promise<FailedEvents> {
|
||||
public GetFailedEvents(): Promise<FailedEvents> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getFailedEvents(req);
|
||||
}
|
||||
|
||||
public async ClearView(viewname: string, db: string): Promise<Empty> {
|
||||
public ClearView(viewname: string, db: string): Promise<Empty> {
|
||||
const req: ViewID = new ViewID();
|
||||
req.setDatabase(db);
|
||||
req.setViewName(viewname);
|
||||
return this.grpcService.admin.clearView(req);
|
||||
}
|
||||
|
||||
public async RemoveFailedEvent(viewname: string, db: string, sequence: number): Promise<Empty> {
|
||||
public RemoveFailedEvent(viewname: string, db: string, sequence: number): Promise<Empty> {
|
||||
const req: FailedEventID = new FailedEventID();
|
||||
req.setDatabase(db);
|
||||
req.setViewName(viewname);
|
||||
@@ -91,29 +91,29 @@ export class AdminService {
|
||||
return this.grpcService.admin.removeFailedEvent(req);
|
||||
}
|
||||
|
||||
public async GetDefaultLoginPolicy(
|
||||
public GetDefaultLoginPolicy(
|
||||
): Promise<DefaultLoginPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultLoginPolicy(req);
|
||||
}
|
||||
|
||||
public async UpdateDefaultLoginPolicy(req: DefaultLoginPolicy): Promise<DefaultLoginPolicy> {
|
||||
public UpdateDefaultLoginPolicy(req: DefaultLoginPolicy): Promise<DefaultLoginPolicy> {
|
||||
return this.grpcService.admin.updateDefaultLoginPolicy(req);
|
||||
}
|
||||
|
||||
public async AddIdpProviderToDefaultLoginPolicy(configId: string): Promise<IdpProviderID> {
|
||||
public AddIdpProviderToDefaultLoginPolicy(configId: string): Promise<IdpProviderID> {
|
||||
const req = new IdpProviderID();
|
||||
req.setIdpConfigId(configId);
|
||||
return this.grpcService.admin.addIdpProviderToDefaultLoginPolicy(req);
|
||||
}
|
||||
|
||||
public async RemoveIdpProviderFromDefaultLoginPolicy(configId: string): Promise<Empty> {
|
||||
public RemoveIdpProviderFromDefaultLoginPolicy(configId: string): Promise<Empty> {
|
||||
const req = new IdpProviderID();
|
||||
req.setIdpConfigId(configId);
|
||||
return this.grpcService.admin.removeIdpProviderFromDefaultLoginPolicy(req);
|
||||
}
|
||||
|
||||
public async GetDefaultLoginPolicyIdpProviders(limit?: number, offset?: number): Promise<IdpProviderSearchResponse> {
|
||||
public GetDefaultLoginPolicyIdpProviders(limit?: number, offset?: number): Promise<IdpProviderSearchResponse> {
|
||||
const req = new IdpProviderSearchRequest();
|
||||
if (limit) {
|
||||
req.setLimit(limit);
|
||||
@@ -124,7 +124,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.getDefaultLoginPolicyIdpProviders(req);
|
||||
}
|
||||
|
||||
public async SearchIdps(
|
||||
public SearchIdps(
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
queryList?: IdpSearchQuery[],
|
||||
@@ -142,7 +142,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.searchIdps(req);
|
||||
}
|
||||
|
||||
public async IdpByID(
|
||||
public IdpByID(
|
||||
id: string,
|
||||
): Promise<IdpView> {
|
||||
const req = new IdpID();
|
||||
@@ -150,25 +150,25 @@ export class AdminService {
|
||||
return this.grpcService.admin.idpByID(req);
|
||||
}
|
||||
|
||||
public async UpdateIdp(
|
||||
req: IdpUpdate,
|
||||
public UpdateIdp(
|
||||
req: IdpUpdate,
|
||||
): Promise<Idp> {
|
||||
return this.grpcService.admin.updateIdpConfig(req);
|
||||
return this.grpcService.admin.updateIdpConfig(req);
|
||||
}
|
||||
|
||||
public async CreateOidcIdp(
|
||||
public CreateOidcIdp(
|
||||
req: OidcIdpConfigCreate,
|
||||
): Promise<Idp> {
|
||||
return this.grpcService.admin.createOidcIdp(req);
|
||||
}
|
||||
|
||||
public async UpdateOidcIdpConfig(
|
||||
public UpdateOidcIdpConfig(
|
||||
req: OidcIdpConfigUpdate,
|
||||
): Promise<OidcIdpConfig> {
|
||||
return this.grpcService.admin.updateOidcIdpConfig(req);
|
||||
}
|
||||
|
||||
public async RemoveIdpConfig(
|
||||
public RemoveIdpConfig(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
@@ -176,7 +176,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.removeIdpConfig(req);
|
||||
}
|
||||
|
||||
public async DeactivateIdpConfig(
|
||||
public DeactivateIdpConfig(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
@@ -184,7 +184,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.deactivateIdpConfig(req);
|
||||
}
|
||||
|
||||
public async ReactivateIdpConfig(
|
||||
public ReactivateIdpConfig(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
@@ -192,7 +192,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.reactivateIdpConfig(req);
|
||||
}
|
||||
|
||||
public async SearchIamMembers(
|
||||
public SearchIamMembers(
|
||||
limit: number,
|
||||
offset: number,
|
||||
queryList?: IamMemberSearchQuery[],
|
||||
@@ -206,7 +206,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.searchIamMembers(req);
|
||||
}
|
||||
|
||||
public async RemoveIamMember(
|
||||
public RemoveIamMember(
|
||||
userId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new RemoveIamMemberRequest();
|
||||
@@ -215,7 +215,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.removeIamMember(req);
|
||||
}
|
||||
|
||||
public async AddIamMember(
|
||||
public AddIamMember(
|
||||
userId: string,
|
||||
rolesList: string[],
|
||||
): Promise<IamMember> {
|
||||
@@ -226,7 +226,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.addIamMember(req);
|
||||
}
|
||||
|
||||
public async ChangeIamMember(
|
||||
public ChangeIamMember(
|
||||
userId: string,
|
||||
rolesList: string[],
|
||||
): Promise<IamMember> {
|
||||
@@ -237,14 +237,14 @@ export class AdminService {
|
||||
return this.grpcService.admin.changeIamMember(req);
|
||||
}
|
||||
|
||||
public async GetOrgIamPolicy(orgId: string): Promise<OrgIamPolicy> {
|
||||
public GetOrgIamPolicy(orgId: string): Promise<OrgIamPolicy> {
|
||||
const req = new OrgIamPolicyID();
|
||||
req.setOrgId(orgId);
|
||||
|
||||
return this.grpcService.admin.getOrgIamPolicy(req);
|
||||
}
|
||||
|
||||
public async CreateOrgIamPolicy(
|
||||
public CreateOrgIamPolicy(
|
||||
orgId: string,
|
||||
description: string,
|
||||
userLoginMustBeDomain: boolean): Promise<OrgIamPolicy> {
|
||||
@@ -256,7 +256,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.createOrgIamPolicy(req);
|
||||
}
|
||||
|
||||
public async UpdateOrgIamPolicy(
|
||||
public UpdateOrgIamPolicy(
|
||||
orgId: string,
|
||||
description: string,
|
||||
userLoginMustBeDomain: boolean): Promise<OrgIamPolicy> {
|
||||
@@ -267,7 +267,7 @@ export class AdminService {
|
||||
return this.grpcService.admin.updateOrgIamPolicy(req);
|
||||
}
|
||||
|
||||
public async deleteOrgIamPolicy(
|
||||
public deleteOrgIamPolicy(
|
||||
orgId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new OrgIamPolicyID();
|
||||
|
||||
@@ -7,6 +7,7 @@ import { catchError, filter, finalize, first, map, mergeMap, switchMap, take, ti
|
||||
import {
|
||||
Changes,
|
||||
ChangesRequest,
|
||||
ExternalIDPRemoveRequest,
|
||||
ExternalIDPSearchRequest,
|
||||
ExternalIDPSearchResponse,
|
||||
Gender,
|
||||
@@ -163,29 +164,29 @@ export class GrpcAuthService {
|
||||
}) > -1;
|
||||
}
|
||||
|
||||
public async GetMyUserProfile(): Promise<UserProfileView> {
|
||||
public GetMyUserProfile(): Promise<UserProfileView> {
|
||||
return this.grpcService.auth.getMyUserProfile(new Empty());
|
||||
}
|
||||
|
||||
public async GetMyPasswordComplexityPolicy(): Promise<PasswordComplexityPolicy> {
|
||||
public GetMyPasswordComplexityPolicy(): Promise<PasswordComplexityPolicy> {
|
||||
return this.grpcService.auth.getMyPasswordComplexityPolicy(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async GetMyUser(): Promise<UserView> {
|
||||
public GetMyUser(): Promise<UserView> {
|
||||
return this.grpcService.auth.getMyUser(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async GetMyMfas(): Promise<MultiFactors> {
|
||||
public GetMyMfas(): Promise<MultiFactors> {
|
||||
return this.grpcService.auth.getMyMfas(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async SearchMyProjectOrgs(
|
||||
public SearchMyProjectOrgs(
|
||||
limit: number,
|
||||
offset: number,
|
||||
queryList?: MyProjectOrgSearchQuery[],
|
||||
@@ -200,7 +201,7 @@ export class GrpcAuthService {
|
||||
return this.grpcService.auth.searchMyProjectOrgs(req);
|
||||
}
|
||||
|
||||
public async SaveMyUserProfile(
|
||||
public SaveMyUserProfile(
|
||||
firstName?: string,
|
||||
lastName?: string,
|
||||
nickName?: string,
|
||||
@@ -230,76 +231,84 @@ export class GrpcAuthService {
|
||||
return this.zitadelPermissions;
|
||||
}
|
||||
|
||||
public async getMyUserSessions(): Promise<UserSessionViews> {
|
||||
public getMyUserSessions(): Promise<UserSessionViews> {
|
||||
return this.grpcService.auth.getMyUserSessions(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async GetMyUserEmail(): Promise<UserEmail> {
|
||||
public GetMyUserEmail(): Promise<UserEmail> {
|
||||
return this.grpcService.auth.getMyUserEmail(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async SaveMyUserEmail(email: string): Promise<UserEmail> {
|
||||
public SaveMyUserEmail(email: string): Promise<UserEmail> {
|
||||
const req = new UpdateUserEmailRequest();
|
||||
req.setEmail(email);
|
||||
return this.grpcService.auth.changeMyUserEmail(req);
|
||||
}
|
||||
|
||||
public async RemoveMyUserPhone(): Promise<Empty> {
|
||||
public RemoveMyUserPhone(): Promise<Empty> {
|
||||
return this.grpcService.auth.removeMyUserPhone(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async GetMyzitadelPermissions(): Promise<MyPermissions> {
|
||||
public GetMyzitadelPermissions(): Promise<MyPermissions> {
|
||||
return this.grpcService.auth.getMyZitadelPermissions(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async GetMyUserPhone(): Promise<UserPhone> {
|
||||
public GetMyUserPhone(): Promise<UserPhone> {
|
||||
return this.grpcService.auth.getMyUserPhone(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async SaveMyUserPhone(phone: string): Promise<UserPhone> {
|
||||
public SaveMyUserPhone(phone: string): Promise<UserPhone> {
|
||||
const req = new UpdateUserPhoneRequest();
|
||||
req.setPhone(phone);
|
||||
return this.grpcService.auth.changeMyUserPhone(req);
|
||||
}
|
||||
|
||||
public async GetMyUserAddress(): Promise<UserAddress> {
|
||||
public GetMyUserAddress(): Promise<UserAddress> {
|
||||
return this.grpcService.auth.getMyUserAddress(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async ResendEmailVerification(): Promise<Empty> {
|
||||
public ResendEmailVerification(): Promise<Empty> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.auth.resendMyEmailVerificationMail(req);
|
||||
}
|
||||
|
||||
public async ResendPhoneVerification(): Promise<Empty> {
|
||||
public ResendPhoneVerification(): Promise<Empty> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.auth.resendMyPhoneVerificationCode(req);
|
||||
}
|
||||
|
||||
public async ChangeMyPassword(oldPassword: string, newPassword: string): Promise<Empty> {
|
||||
public ChangeMyPassword(oldPassword: string, newPassword: string): Promise<Empty> {
|
||||
const req = new PasswordChange();
|
||||
req.setOldPassword(oldPassword);
|
||||
req.setNewPassword(newPassword);
|
||||
return this.grpcService.auth.changeMyPassword(req);
|
||||
}
|
||||
|
||||
public async SearchExternalIdps(
|
||||
userId: string,
|
||||
public RemoveExternalIDP(
|
||||
externalUserId: string,
|
||||
idpConfigId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new ExternalIDPRemoveRequest();
|
||||
req.setExternalUserId(externalUserId);
|
||||
req.setIdpConfigId(idpConfigId);
|
||||
return this.grpcService.auth.removeMyExternalIDP(req);
|
||||
}
|
||||
|
||||
public SearchMyExternalIdps(
|
||||
limit: number,
|
||||
offset: number,
|
||||
asc?: boolean,
|
||||
): Promise<ExternalIDPSearchResponse> {
|
||||
const req = new ExternalIDPSearchRequest();
|
||||
req.setLimit(limit);
|
||||
@@ -307,31 +316,31 @@ export class GrpcAuthService {
|
||||
return this.grpcService.auth.searchMyExternalIDPs(req);
|
||||
}
|
||||
|
||||
public async AddMfaOTP(): Promise<MfaOtpResponse> {
|
||||
public AddMfaOTP(): Promise<MfaOtpResponse> {
|
||||
return this.grpcService.auth.addMfaOTP(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async RemoveMfaOTP(): Promise<Empty> {
|
||||
public RemoveMfaOTP(): Promise<Empty> {
|
||||
return this.grpcService.auth.removeMfaOTP(
|
||||
new Empty(),
|
||||
);
|
||||
}
|
||||
|
||||
public async VerifyMfaOTP(code: string): Promise<Empty> {
|
||||
public VerifyMfaOTP(code: string): Promise<Empty> {
|
||||
const req = new VerifyMfaOtp();
|
||||
req.setCode(code);
|
||||
return this.grpcService.auth.verifyMfaOTP(req);
|
||||
}
|
||||
|
||||
public async VerifyMyUserPhone(code: string): Promise<Empty> {
|
||||
public VerifyMyUserPhone(code: string): Promise<Empty> {
|
||||
const req = new VerifyUserPhoneRequest();
|
||||
req.setCode(code);
|
||||
return this.grpcService.auth.verifyMyUserPhone(req);
|
||||
}
|
||||
|
||||
public async SaveMyUserAddress(address: UserAddress.AsObject): Promise<UserAddress> {
|
||||
public SaveMyUserAddress(address: UserAddress.AsObject): Promise<UserAddress> {
|
||||
const req = new UpdateUserAddressRequest();
|
||||
req.setStreetAddress(address.streetAddress);
|
||||
req.setPostalCode(address.postalCode);
|
||||
@@ -341,7 +350,7 @@ export class GrpcAuthService {
|
||||
return this.grpcService.auth.updateMyUserAddress(req);
|
||||
}
|
||||
|
||||
public async GetMyUserChanges(limit: number, sequenceoffset: number): Promise<Changes> {
|
||||
public GetMyUserChanges(limit: number, sequenceoffset: number): Promise<Changes> {
|
||||
const req = new ChangesRequest();
|
||||
req.setLimit(limit);
|
||||
req.setSequenceOffset(sequenceoffset);
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Request, UnaryInterceptor, UnaryResponse } from 'grpc-web';
|
||||
import { filter, first, take } from 'rxjs/operators';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
|
||||
import { AuthenticationService } from '../authentication.service';
|
||||
import { StorageService } from '../storage.service';
|
||||
|
||||
|
||||
const authorizationKey = 'Authorization';
|
||||
const bearerPrefix = 'Bearer';
|
||||
const accessTokenStorageKey = 'access_token';
|
||||
@Injectable({ providedIn: 'root' })
|
||||
/**
|
||||
* Set the authentication token
|
||||
*/
|
||||
export class AuthInterceptor<TReq = unknown, TResp = unknown> implements UnaryInterceptor<TReq, TResp> {
|
||||
constructor(
|
||||
private authenticationService: AuthenticationService,
|
||||
private storageService: StorageService,
|
||||
private dialog: MatDialog,
|
||||
) { }
|
||||
|
||||
public async intercept(request: Request<TReq, TResp>, invoker: any): Promise<UnaryResponse<TReq, TResp>> {
|
||||
await this.authenticationService.authenticationChanged.pipe(
|
||||
filter((authed) => !!authed),
|
||||
first(),
|
||||
).toPromise();
|
||||
|
||||
const metadata = request.getMetadata();
|
||||
const accessToken = this.storageService.getItem(accessTokenStorageKey);
|
||||
metadata[authorizationKey] = `${bearerPrefix} ${accessToken}`;
|
||||
|
||||
return invoker(request).then((response: any) => {
|
||||
return response;
|
||||
}).catch((error: any) => {
|
||||
console.error('error: ', error);
|
||||
if (error.code === 16) {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.LOGIN',
|
||||
titleKey: 'ERRORS.TOKENINVALID.TITLE',
|
||||
descriptionKey: 'ERRORS.TOKENINVALID.DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().pipe(take(1)).subscribe(resp => {
|
||||
if (resp) {
|
||||
this.authenticationService.authenticate(undefined, true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Request, UnaryInterceptor, UnaryResponse } from 'grpc-web';
|
||||
import { filter, first, take } from 'rxjs/operators';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
|
||||
import { AuthenticationService } from '../authentication.service';
|
||||
import { StorageService } from '../storage.service';
|
||||
|
||||
|
||||
const authorizationKey = 'Authorization';
|
||||
const bearerPrefix = 'Bearer';
|
||||
const accessTokenStorageKey = 'access_token';
|
||||
@Injectable({ providedIn: 'root' })
|
||||
/**
|
||||
* Set the authentication token
|
||||
*/
|
||||
export class AuthInterceptor<TReq = unknown, TResp = unknown> implements UnaryInterceptor<TReq, TResp> {
|
||||
constructor(
|
||||
private authenticationService: AuthenticationService,
|
||||
private storageService: StorageService,
|
||||
private dialog: MatDialog,
|
||||
) { }
|
||||
|
||||
public async intercept(request: Request<TReq, TResp>, invoker: any): Promise<UnaryResponse<TReq, TResp>> {
|
||||
await this.authenticationService.authenticationChanged.pipe(
|
||||
filter((authed) => !!authed),
|
||||
first(),
|
||||
).toPromise();
|
||||
|
||||
const metadata = request.getMetadata();
|
||||
const accessToken = this.storageService.getItem(accessTokenStorageKey);
|
||||
metadata[authorizationKey] = `${bearerPrefix} ${accessToken}`;
|
||||
|
||||
return invoker(request).then((response: any) => {
|
||||
return response;
|
||||
}).catch((error: any) => {
|
||||
if (error.code === 16) {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.LOGIN',
|
||||
titleKey: 'ERRORS.TOKENINVALID.TITLE',
|
||||
descriptionKey: 'ERRORS.TOKENINVALID.DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().pipe(take(1)).subscribe(resp => {
|
||||
if (resp) {
|
||||
this.authenticationService.authenticate(undefined, true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user