mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-06 06:12:16 +00:00
feat: protos refactoring
* start with user * user first try done in all services * user, org, idp for discussion * remove unused stuff * bla * dockerbuild * rename search, get multiple to list... * add annotation * update proto dependencies * update proto dependencies * change proto imports * replace all old imports * fix go out * remove unused lines * correct protoc flags * grpc and openapi flags * go out source path relative * -p * remove dead code * sourcepath relative * ls * is onenapi the problem? * hobla * authoption output * wrong field name * gopf * correct option, add correct flags * small improvments * SIMPLYFY * relative path * gopf bin ich en tubel * correct path * default policies in admin * grpc generation in one file * remove non ascii * metadata on manipulations * correct auth_option import * fixes * larry * idp provider to idp * fix generate * admin and auth nearly done * admin and auth nearly done * gen * healthz * imports * deleted too much imports * fix org * add import * imports * import * naming * auth_opt * gopf * management * imports * _TYPE_UNSPECIFIED * improts * auth opts * management policies * imports * passwordlessType to MFAType * auth_opt * add user grant calls * add missing messages * result * fix option * improvements * ids * fix http * imports * fixes * fields * body * add fields * remove wrong member query * fix request response * fixes * add copy files * variable versions * generate all files * improvements * add dependencies * factors * user session * oidc information, iam * remove unused file * changes * enums * dockerfile * fix build * remove unused folder * update readme for build * move old server impl * add event type to change * some changes * start admin * remove wrong field * admin only list calls missing * fix proto numbers * surprisingly it compiles * service ts changes * admin mgmt * mgmt * auth manipulation and gets done, lists missing * validations and some field changes * validations * enum validations * remove todo * move proto files to proto/zitadel * change proto path in dockerfile * it compiles! * add validate import * remove duplicate import * fix protos * fix import * tests * cleanup * remove unimplemented methods * iam member multiple queries * all auth and admin calls * add initial password on crate human * message names * management user server * machine done * fix: todos (#1346) * fix: pub sub in new eventstore * fix: todos * fix: todos * fix: todos * fix: todos * fix: todos * fix tests * fix: search method domain * admin service, user import type typescript * admin changes * admin changes * fix: search method domain * more user grpc and begin org, fix configs * fix: return object details * org grpc * remove creation date add details * app * fix: return object details * fix: return object details * mgmt service, project members * app * fix: convert policies * project, members, granted projects, searches * fix: convert usergrants * fix: convert usergrants * auth user detail, user detail, mfa, second factor, auth * fix: convert usergrants * mfa, memberships, password, owned proj detail * fix: convert usergrants * project grant * missing details * changes, userview * idp table, keys * org list and user table filter * unify rest paths (#1381) * unify rest paths * post for all searches, mfa to multi_factor, secondfactor to second_factor * remove v1 * fix tests * rename api client key to app key * machine keys, age policy * user list, machine keys, changes * fix: org states * add default flag to policy * second factor to type * idp id * app type * unify ListQuery, ListDetails, ObjectDetails field names * user grants, apps, memberships * fix type params * metadata to detail, linke idps * api create, membership, app detail, create * idp, app, policy * queries, multi -> auth factors and missing fields * update converters * provider to user, remove old mgmt refs * temp remove authfactor dialog, build finish Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Fabi <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: Fabiennne <[email protected]>
This commit is contained in:
co-authored by
Max Peintner
Fabi
Livio Amstutz
Fabiennne
parent
9f417f3957
commit
dabd5920dc
@@ -1,60 +1,96 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Empty } from 'google-protobuf/google/protobuf/empty_pb';
|
||||
|
||||
import {
|
||||
AddIamMemberRequest,
|
||||
ChangeIamMemberRequest,
|
||||
CreateHumanRequest,
|
||||
CreateOrgRequest,
|
||||
CreateUserRequest,
|
||||
DefaultLabelPolicy,
|
||||
DefaultLabelPolicyUpdate,
|
||||
DefaultLabelPolicyView,
|
||||
DefaultLoginPolicy,
|
||||
DefaultLoginPolicyRequest,
|
||||
DefaultLoginPolicyView,
|
||||
DefaultPasswordAgePolicyRequest,
|
||||
DefaultPasswordAgePolicyView,
|
||||
DefaultPasswordComplexityPolicy,
|
||||
DefaultPasswordComplexityPolicyRequest,
|
||||
DefaultPasswordComplexityPolicyView,
|
||||
DefaultPasswordLockoutPolicy,
|
||||
DefaultPasswordLockoutPolicyRequest,
|
||||
DefaultPasswordLockoutPolicyView,
|
||||
FailedEventID,
|
||||
FailedEvents,
|
||||
IamMember,
|
||||
IamMemberRoles,
|
||||
IamMemberSearchQuery,
|
||||
IamMemberSearchRequest,
|
||||
IamMemberSearchResponse,
|
||||
Idp,
|
||||
IdpID,
|
||||
IdpProviderID,
|
||||
IdpProviderSearchRequest,
|
||||
IdpProviderSearchResponse,
|
||||
IdpSearchQuery,
|
||||
IdpSearchRequest,
|
||||
IdpSearchResponse,
|
||||
IdpView,
|
||||
MultiFactor,
|
||||
MultiFactorsResult,
|
||||
OidcIdpConfig,
|
||||
OidcIdpConfigCreate,
|
||||
OidcIdpConfigUpdate,
|
||||
OrgIamPolicy,
|
||||
OrgIamPolicyID,
|
||||
OrgIamPolicyRequest,
|
||||
OrgIamPolicyView,
|
||||
OrgSetUpRequest,
|
||||
OrgSetUpResponse,
|
||||
RemoveIamMemberRequest,
|
||||
SecondFactor,
|
||||
SecondFactorsResult,
|
||||
ViewID,
|
||||
Views,
|
||||
} from '../proto/generated/admin_pb';
|
||||
import { IdpUpdate } from '../proto/generated/management_pb';
|
||||
AddCustomOrgIAMPolicyRequest,
|
||||
AddCustomOrgIAMPolicyResponse,
|
||||
AddIAMMemberRequest,
|
||||
AddIAMMemberResponse,
|
||||
AddIDPToLoginPolicyRequest,
|
||||
AddIDPToLoginPolicyResponse,
|
||||
AddMultiFactorToLoginPolicyRequest,
|
||||
AddMultiFactorToLoginPolicyResponse,
|
||||
AddOIDCIDPRequest,
|
||||
AddOIDCIDPResponse,
|
||||
AddSecondFactorToLoginPolicyRequest,
|
||||
AddSecondFactorToLoginPolicyResponse,
|
||||
ClearViewRequest,
|
||||
ClearViewResponse,
|
||||
DeactivateIDPRequest,
|
||||
DeactivateIDPResponse,
|
||||
GetCustomOrgIAMPolicyRequest,
|
||||
GetCustomOrgIAMPolicyResponse,
|
||||
GetIDPByIDRequest,
|
||||
GetIDPByIDResponse,
|
||||
GetLabelPolicyRequest,
|
||||
GetLabelPolicyResponse,
|
||||
GetLoginPolicyRequest,
|
||||
GetLoginPolicyResponse,
|
||||
GetOrgIAMPolicyRequest,
|
||||
GetOrgIAMPolicyResponse,
|
||||
GetPasswordAgePolicyRequest,
|
||||
GetPasswordAgePolicyResponse,
|
||||
GetPasswordComplexityPolicyRequest,
|
||||
GetPasswordComplexityPolicyResponse,
|
||||
GetPasswordLockoutPolicyRequest,
|
||||
GetPasswordLockoutPolicyResponse,
|
||||
IDPQuery,
|
||||
ListFailedEventsRequest,
|
||||
ListFailedEventsResponse,
|
||||
ListIAMMemberRolesRequest,
|
||||
ListIAMMemberRolesResponse,
|
||||
ListIAMMembersRequest,
|
||||
ListIAMMembersResponse,
|
||||
ListIDPsRequest,
|
||||
ListIDPsResponse,
|
||||
ListLoginPolicyIDPsRequest,
|
||||
ListLoginPolicyIDPsResponse,
|
||||
ListLoginPolicyMultiFactorsRequest,
|
||||
ListLoginPolicyMultiFactorsResponse,
|
||||
ListLoginPolicySecondFactorsRequest,
|
||||
ListLoginPolicySecondFactorsResponse,
|
||||
ListViewsRequest,
|
||||
ListViewsResponse,
|
||||
ReactivateIDPRequest,
|
||||
ReactivateIDPResponse,
|
||||
RemoveFailedEventRequest,
|
||||
RemoveFailedEventResponse,
|
||||
RemoveIAMMemberRequest,
|
||||
RemoveIAMMemberResponse,
|
||||
RemoveIDPFromLoginPolicyRequest,
|
||||
RemoveIDPFromLoginPolicyResponse,
|
||||
RemoveIDPRequest,
|
||||
RemoveIDPResponse,
|
||||
RemoveMultiFactorFromLoginPolicyRequest,
|
||||
RemoveMultiFactorFromLoginPolicyResponse,
|
||||
RemoveSecondFactorFromLoginPolicyRequest,
|
||||
RemoveSecondFactorFromLoginPolicyResponse,
|
||||
ResetCustomOrgIAMPolicyToDefaultRequest,
|
||||
ResetCustomOrgIAMPolicyToDefaultResponse,
|
||||
SetUpOrgRequest,
|
||||
SetUpOrgResponse,
|
||||
UpdateCustomOrgIAMPolicyRequest,
|
||||
UpdateCustomOrgIAMPolicyResponse,
|
||||
UpdateIAMMemberRequest,
|
||||
UpdateIAMMemberResponse,
|
||||
UpdateIDPOIDCConfigRequest,
|
||||
UpdateIDPOIDCConfigResponse,
|
||||
UpdateIDPRequest,
|
||||
UpdateIDPResponse,
|
||||
UpdateLabelPolicyRequest,
|
||||
UpdateLabelPolicyResponse,
|
||||
UpdateLoginPolicyRequest,
|
||||
UpdateLoginPolicyResponse,
|
||||
UpdateOrgIAMPolicyRequest,
|
||||
UpdateOrgIAMPolicyResponse,
|
||||
UpdatePasswordAgePolicyRequest,
|
||||
UpdatePasswordAgePolicyResponse,
|
||||
UpdatePasswordComplexityPolicyRequest,
|
||||
UpdatePasswordComplexityPolicyResponse,
|
||||
UpdatePasswordLockoutPolicyRequest,
|
||||
UpdatePasswordLockoutPolicyResponse,
|
||||
} from '../proto/generated/zitadel/admin_pb';
|
||||
import { SearchQuery } from '../proto/generated/zitadel/member_pb';
|
||||
import { ListQuery } from '../proto/generated/zitadel/object_pb';
|
||||
import { GrpcService } from './grpc.service';
|
||||
|
||||
@Injectable({
|
||||
@@ -64,338 +100,352 @@ export class AdminService {
|
||||
constructor(private readonly grpcService: GrpcService) { }
|
||||
|
||||
public SetUpOrg(
|
||||
createOrgRequest: CreateOrgRequest,
|
||||
humanRequest: CreateHumanRequest,
|
||||
): Promise<OrgSetUpResponse> {
|
||||
const req: OrgSetUpRequest = new OrgSetUpRequest();
|
||||
const userReq: CreateUserRequest = new CreateUserRequest();
|
||||
org: SetUpOrgRequest.Org,
|
||||
human: SetUpOrgRequest.Human,
|
||||
): Promise<SetUpOrgResponse.AsObject> {
|
||||
const req = new SetUpOrgRequest();
|
||||
|
||||
userReq.setHuman(humanRequest);
|
||||
req.setOrg(org);
|
||||
req.setHuman(human);
|
||||
|
||||
req.setOrg(createOrgRequest);
|
||||
req.setUser(userReq);
|
||||
|
||||
return this.grpcService.admin.setUpOrg(req);
|
||||
return this.grpcService.admin.setUpOrg(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public getDefaultLoginPolicyMultiFactors(): Promise<MultiFactorsResult> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultLoginPolicyMultiFactors(req);
|
||||
public listLoginPolicyMultiFactors(): Promise<ListLoginPolicyMultiFactorsResponse.AsObject> {
|
||||
const req = new ListLoginPolicyMultiFactorsRequest();
|
||||
return this.grpcService.admin.listLoginPolicyMultiFactors(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public addMultiFactorToDefaultLoginPolicy(req: MultiFactor): Promise<MultiFactor> {
|
||||
return this.grpcService.admin.addMultiFactorToDefaultLoginPolicy(req);
|
||||
public addMultiFactorToLoginPolicy(req: AddMultiFactorToLoginPolicyRequest): Promise<AddMultiFactorToLoginPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.addMultiFactorToLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveMultiFactorFromDefaultLoginPolicy(req: MultiFactor): Promise<Empty> {
|
||||
return this.grpcService.admin.removeMultiFactorFromDefaultLoginPolicy(req);
|
||||
public removeMultiFactorFromLoginPolicy(req: RemoveMultiFactorFromLoginPolicyRequest): Promise<RemoveMultiFactorFromLoginPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.removeMultiFactorFromLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public GetDefaultLoginPolicySecondFactors(): Promise<SecondFactorsResult> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultLoginPolicySecondFactors(req);
|
||||
public listLoginPolicySecondFactors(): Promise<ListLoginPolicySecondFactorsResponse.AsObject> {
|
||||
const req = new ListLoginPolicySecondFactorsRequest();
|
||||
return this.grpcService.admin.listLoginPolicySecondFactors(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public AddSecondFactorToDefaultLoginPolicy(req: SecondFactor): Promise<SecondFactor> {
|
||||
return this.grpcService.admin.addSecondFactorToDefaultLoginPolicy(req);
|
||||
public addSecondFactorToLoginPolicy(req: AddSecondFactorToLoginPolicyRequest): Promise<AddSecondFactorToLoginPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.addSecondFactorToLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveSecondFactorFromDefaultLoginPolicy(req: SecondFactor): Promise<Empty> {
|
||||
return this.grpcService.admin.removeSecondFactorFromDefaultLoginPolicy(req);
|
||||
public removeSecondFactorFromLoginPolicy(req: RemoveSecondFactorFromLoginPolicyRequest): Promise<RemoveSecondFactorFromLoginPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.removeSecondFactorFromLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public GetIamMemberRoles(): Promise<IamMemberRoles> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getIamMemberRoles(req);
|
||||
public listIAMMemberRoles(): Promise<ListIAMMemberRolesResponse.AsObject> {
|
||||
const req = new ListIAMMemberRolesRequest();
|
||||
return this.grpcService.admin.listIAMMemberRoles(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public GetViews(): Promise<Views> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getViews(req);
|
||||
public listViews(): Promise<ListViewsResponse.AsObject> {
|
||||
const req = new ListViewsRequest();
|
||||
return this.grpcService.admin.listViews(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public GetFailedEvents(): Promise<FailedEvents> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getFailedEvents(req);
|
||||
public listFailedEvents(): Promise<ListFailedEventsResponse.AsObject> {
|
||||
const req = new ListFailedEventsRequest();
|
||||
return this.grpcService.admin.listFailedEvents(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public ClearView(viewname: string, db: string): Promise<Empty> {
|
||||
const req: ViewID = new ViewID();
|
||||
public clearView(viewname: string, db: string): Promise<ClearViewResponse.AsObject> {
|
||||
const req = new ClearViewRequest();
|
||||
req.setDatabase(db);
|
||||
req.setViewName(viewname);
|
||||
return this.grpcService.admin.clearView(req);
|
||||
return this.grpcService.admin.clearView(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveFailedEvent(viewname: string, db: string, sequence: number): Promise<Empty> {
|
||||
const req: FailedEventID = new FailedEventID();
|
||||
public removeFailedEvent(viewname: string, db: string, sequence: number): Promise<RemoveFailedEventResponse.AsObject> {
|
||||
const req = new RemoveFailedEventRequest();
|
||||
req.setDatabase(db);
|
||||
req.setViewName(viewname);
|
||||
req.setFailedSequence(sequence);
|
||||
return this.grpcService.admin.removeFailedEvent(req);
|
||||
return this.grpcService.admin.removeFailedEvent(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* Policies */
|
||||
|
||||
/* complexity */
|
||||
|
||||
public GetDefaultPasswordComplexityPolicy(): Promise<DefaultPasswordComplexityPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultPasswordComplexityPolicy(req);
|
||||
public getPasswordComplexityPolicy(): Promise<GetPasswordComplexityPolicyResponse.AsObject> {
|
||||
const req = new GetPasswordComplexityPolicyRequest();
|
||||
return this.grpcService.admin.getPasswordComplexityPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateDefaultPasswordComplexityPolicy(
|
||||
public updatePasswordComplexityPolicy(
|
||||
hasLowerCase: boolean,
|
||||
hasUpperCase: boolean,
|
||||
hasNumber: boolean,
|
||||
hasSymbol: boolean,
|
||||
minLength: number,
|
||||
): Promise<DefaultPasswordComplexityPolicy> {
|
||||
const req = new DefaultPasswordComplexityPolicyRequest();
|
||||
): Promise<UpdatePasswordComplexityPolicyResponse.AsObject> {
|
||||
const req = new UpdatePasswordComplexityPolicyRequest();
|
||||
req.setHasLowercase(hasLowerCase);
|
||||
req.setHasUppercase(hasUpperCase);
|
||||
req.setHasNumber(hasNumber);
|
||||
req.setHasSymbol(hasSymbol);
|
||||
req.setMinLength(minLength);
|
||||
return this.grpcService.admin.updateDefaultPasswordComplexityPolicy(req);
|
||||
return this.grpcService.admin.updatePasswordComplexityPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* age */
|
||||
|
||||
public GetDefaultPasswordAgePolicy(): Promise<DefaultPasswordAgePolicyView> {
|
||||
const req = new Empty();
|
||||
public getPasswordAgePolicy(): Promise<GetPasswordAgePolicyResponse.AsObject> {
|
||||
const req = new GetPasswordAgePolicyRequest();
|
||||
|
||||
return this.grpcService.admin.getDefaultPasswordAgePolicy(req);
|
||||
return this.grpcService.admin.getPasswordAgePolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateDefaultPasswordAgePolicy(
|
||||
public updatePasswordAgePolicy(
|
||||
maxAgeDays: number,
|
||||
expireWarnDays: number,
|
||||
): Promise<DefaultPasswordAgePolicyView> {
|
||||
const req = new DefaultPasswordAgePolicyRequest();
|
||||
): Promise<UpdatePasswordAgePolicyResponse.AsObject> {
|
||||
const req = new UpdatePasswordAgePolicyRequest();
|
||||
req.setMaxAgeDays(maxAgeDays);
|
||||
req.setExpireWarnDays(expireWarnDays);
|
||||
|
||||
return this.grpcService.admin.updateDefaultPasswordAgePolicy(req);
|
||||
return this.grpcService.admin.updatePasswordAgePolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* lockout */
|
||||
|
||||
public GetDefaultPasswordLockoutPolicy(): Promise<DefaultPasswordLockoutPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultPasswordLockoutPolicy(req);
|
||||
public getPasswordLockoutPolicy(): Promise<GetPasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new GetPasswordLockoutPolicyRequest();
|
||||
return this.grpcService.admin.getPasswordLockoutPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateDefaultPasswordLockoutPolicy(
|
||||
public updatePasswordLockoutPolicy(
|
||||
maxAttempts: number,
|
||||
showLockoutFailures: boolean,
|
||||
): Promise<DefaultPasswordLockoutPolicy> {
|
||||
const req = new DefaultPasswordLockoutPolicyRequest();
|
||||
): Promise<UpdatePasswordLockoutPolicyResponse.AsObject> {
|
||||
const req = new UpdatePasswordLockoutPolicyRequest();
|
||||
req.setMaxAttempts(maxAttempts);
|
||||
req.setShowLockoutFailure(showLockoutFailures);
|
||||
|
||||
return this.grpcService.admin.updateDefaultPasswordLockoutPolicy(req);
|
||||
return this.grpcService.admin.updatePasswordLockoutPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* label */
|
||||
|
||||
public GetDefaultLabelPolicy(): Promise<DefaultLabelPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultLabelPolicy(req);
|
||||
public getLabelPolicy(): Promise<GetLabelPolicyResponse.AsObject> {
|
||||
const req = new GetLabelPolicyRequest();
|
||||
return this.grpcService.admin.getLabelPolicy(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public UpdateDefaultLabelPolicy(req: DefaultLabelPolicyUpdate): Promise<DefaultLabelPolicy> {
|
||||
return this.grpcService.admin.updateDefaultLabelPolicy(req);
|
||||
public updateLabelPolicy(req: UpdateLabelPolicyRequest): Promise<UpdateLabelPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.updateLabelPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* login */
|
||||
|
||||
public GetDefaultLoginPolicy(
|
||||
): Promise<DefaultLoginPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultLoginPolicy(req);
|
||||
public getLoginPolicy(
|
||||
): Promise<GetLoginPolicyResponse.AsObject> {
|
||||
const req = new GetLoginPolicyRequest();
|
||||
return this.grpcService.admin.getLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateDefaultLoginPolicy(req: DefaultLoginPolicyRequest): Promise<DefaultLoginPolicy> {
|
||||
return this.grpcService.admin.updateDefaultLoginPolicy(req);
|
||||
public updateLoginPolicy(req: UpdateLoginPolicyRequest): Promise<UpdateLoginPolicyResponse.AsObject> {
|
||||
return this.grpcService.admin.updateLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* org iam */
|
||||
|
||||
public GetOrgIamPolicy(orgId: string): Promise<OrgIamPolicyView> {
|
||||
const req = new OrgIamPolicyID();
|
||||
public getCustomOrgIAMPolicy(orgId: string): Promise<GetCustomOrgIAMPolicyResponse.AsObject> {
|
||||
const req = new GetCustomOrgIAMPolicyRequest();
|
||||
req.setOrgId(orgId);
|
||||
return this.grpcService.admin.getOrgIamPolicy(req);
|
||||
return this.grpcService.admin.getCustomOrgIAMPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public CreateOrgIamPolicy(
|
||||
public addCustomOrgIAMPolicy(
|
||||
orgId: string,
|
||||
userLoginMustBeDomain: boolean): Promise<OrgIamPolicy> {
|
||||
const req = new OrgIamPolicyRequest();
|
||||
userLoginMustBeDomain: boolean): Promise<AddCustomOrgIAMPolicyResponse.AsObject> {
|
||||
const req = new AddCustomOrgIAMPolicyRequest();
|
||||
req.setOrgId(orgId);
|
||||
req.setUserLoginMustBeDomain(userLoginMustBeDomain);
|
||||
|
||||
return this.grpcService.admin.createOrgIamPolicy(req);
|
||||
return this.grpcService.admin.addCustomOrgIAMPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateOrgIamPolicy(
|
||||
public updateCustomOrgIAMPolicy(
|
||||
orgId: string,
|
||||
userLoginMustBeDomain: boolean): Promise<OrgIamPolicy> {
|
||||
const req = new OrgIamPolicyRequest();
|
||||
userLoginMustBeDomain: boolean): Promise<UpdateCustomOrgIAMPolicyResponse.AsObject> {
|
||||
const req = new UpdateCustomOrgIAMPolicyRequest();
|
||||
req.setOrgId(orgId);
|
||||
req.setUserLoginMustBeDomain(userLoginMustBeDomain);
|
||||
return this.grpcService.admin.updateOrgIamPolicy(req);
|
||||
return this.grpcService.admin.updateCustomOrgIAMPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveOrgIamPolicy(
|
||||
public resetCustomOrgIAMPolicyToDefault(
|
||||
orgId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new OrgIamPolicyID();
|
||||
): Promise<ResetCustomOrgIAMPolicyToDefaultResponse.AsObject> {
|
||||
const req = new ResetCustomOrgIAMPolicyToDefaultRequest();
|
||||
req.setOrgId(orgId);
|
||||
return this.grpcService.admin.removeOrgIamPolicy(req);
|
||||
return this.grpcService.admin.resetCustomOrgIAMPolicyToDefault(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* admin iam */
|
||||
|
||||
public GetDefaultOrgIamPolicy(): Promise<OrgIamPolicyView> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.admin.getDefaultOrgIamPolicy(req);
|
||||
public getOrgIAMPolicy(): Promise<GetOrgIAMPolicyResponse.AsObject> {
|
||||
const req = new GetOrgIAMPolicyRequest();
|
||||
return this.grpcService.admin.getOrgIAMPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public updateOrgIAMPolicy(userLoginMustBeDomain: boolean): Promise<UpdateOrgIAMPolicyResponse.AsObject> {
|
||||
const req = new UpdateOrgIAMPolicyRequest();
|
||||
req.setUserLoginMustBeDomain(userLoginMustBeDomain);
|
||||
return this.grpcService.admin.updateOrgIAMPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
/* policies end */
|
||||
|
||||
public AddIdpProviderToDefaultLoginPolicy(configId: string): Promise<IdpProviderID> {
|
||||
const req = new IdpProviderID();
|
||||
req.setIdpConfigId(configId);
|
||||
return this.grpcService.admin.addIdpProviderToDefaultLoginPolicy(req);
|
||||
public addIDPToLoginPolicy(idpId: string): Promise<AddIDPToLoginPolicyResponse.AsObject> {
|
||||
const req = new AddIDPToLoginPolicyRequest();
|
||||
req.setIdpId(idpId);
|
||||
return this.grpcService.admin.addIDPToLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveIdpProviderFromDefaultLoginPolicy(configId: string): Promise<Empty> {
|
||||
const req = new IdpProviderID();
|
||||
req.setIdpConfigId(configId);
|
||||
return this.grpcService.admin.removeIdpProviderFromDefaultLoginPolicy(req);
|
||||
public removeIDPFromLoginPolicy(idpId: string): Promise<RemoveIDPFromLoginPolicyResponse.AsObject> {
|
||||
const req = new RemoveIDPFromLoginPolicyRequest();
|
||||
req.setIdpId(idpId);
|
||||
return this.grpcService.admin.removeIDPFromLoginPolicy(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public GetDefaultLoginPolicyIdpProviders(limit?: number, offset?: number): Promise<IdpProviderSearchResponse> {
|
||||
const req = new IdpProviderSearchRequest();
|
||||
public listLoginPolicyIDPs(limit?: number, offset?: number): Promise<ListLoginPolicyIDPsResponse.AsObject> {
|
||||
const req = new ListLoginPolicyIDPsRequest();
|
||||
const query = new ListQuery();
|
||||
if (limit) {
|
||||
req.setLimit(limit);
|
||||
query.setLimit(limit);
|
||||
}
|
||||
if (offset) {
|
||||
req.setOffset(offset);
|
||||
query.setOffset(offset);
|
||||
}
|
||||
return this.grpcService.admin.getDefaultLoginPolicyIdpProviders(req);
|
||||
req.setQuery(query);
|
||||
return this.grpcService.admin.listLoginPolicyIDPs(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public SearchIdps(
|
||||
public listIDPs(
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
queryList?: IdpSearchQuery[],
|
||||
): Promise<IdpSearchResponse> {
|
||||
const req = new IdpSearchRequest();
|
||||
queriesList?: IDPQuery[],
|
||||
): Promise<ListIDPsResponse.AsObject> {
|
||||
const req = new ListIDPsRequest();
|
||||
const query = new ListQuery();
|
||||
|
||||
if (limit) {
|
||||
req.setLimit(limit);
|
||||
query.setLimit(limit);
|
||||
}
|
||||
if (offset) {
|
||||
req.setOffset(offset);
|
||||
query.setOffset(offset);
|
||||
}
|
||||
if (queryList) {
|
||||
req.setQueriesList(queryList);
|
||||
if (queriesList) {
|
||||
req.setQueriesList(queriesList);
|
||||
}
|
||||
return this.grpcService.admin.searchIdps(req);
|
||||
req.setQuery(query);
|
||||
return this.grpcService.admin.listIDPs(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public IdpByID(
|
||||
public getIDPByID(
|
||||
id: string,
|
||||
): Promise<IdpView> {
|
||||
const req = new IdpID();
|
||||
): Promise<GetIDPByIDResponse.AsObject> {
|
||||
const req = new GetIDPByIDRequest();
|
||||
req.setId(id);
|
||||
return this.grpcService.admin.idpByID(req);
|
||||
return this.grpcService.admin.getIDPByID(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateIdp(
|
||||
req: IdpUpdate,
|
||||
): Promise<Idp> {
|
||||
return this.grpcService.admin.updateIdpConfig(req);
|
||||
public updateIDP(
|
||||
req: UpdateIDPRequest,
|
||||
): Promise<UpdateIDPResponse.AsObject> {
|
||||
return this.grpcService.admin.updateIDP(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public CreateOidcIdp(
|
||||
req: OidcIdpConfigCreate,
|
||||
): Promise<Idp> {
|
||||
return this.grpcService.admin.createOidcIdp(req);
|
||||
public addOIDCIDP(
|
||||
req: AddOIDCIDPRequest,
|
||||
): Promise<AddOIDCIDPResponse.AsObject> {
|
||||
return this.grpcService.admin.addOIDCIDP(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public UpdateOidcIdpConfig(
|
||||
req: OidcIdpConfigUpdate,
|
||||
): Promise<OidcIdpConfig> {
|
||||
return this.grpcService.admin.updateOidcIdpConfig(req);
|
||||
public updateIDPOIDCConfig(
|
||||
req: UpdateIDPOIDCConfigRequest,
|
||||
): Promise<UpdateIDPOIDCConfigResponse.AsObject> {
|
||||
return this.grpcService.admin.updateIDPOIDCConfig(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveIdpConfig(
|
||||
public removeIDP(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
req.setId(id);
|
||||
return this.grpcService.admin.removeIdpConfig(req);
|
||||
): Promise<RemoveIDPResponse.AsObject> {
|
||||
const req = new RemoveIDPRequest;
|
||||
req.setIdpId(id);
|
||||
return this.grpcService.admin.removeIDP(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public DeactivateIdpConfig(
|
||||
public deactivateIDP(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
req.setId(id);
|
||||
return this.grpcService.admin.deactivateIdpConfig(req);
|
||||
): Promise<DeactivateIDPResponse.AsObject> {
|
||||
const req = new DeactivateIDPRequest;
|
||||
req.setIdpId(id);
|
||||
return this.grpcService.admin.deactivateIDP(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public ReactivateIdpConfig(
|
||||
public reactivateIDP(
|
||||
id: string,
|
||||
): Promise<Empty> {
|
||||
const req = new IdpID;
|
||||
req.setId(id);
|
||||
return this.grpcService.admin.reactivateIdpConfig(req);
|
||||
): Promise<ReactivateIDPResponse.AsObject> {
|
||||
const req = new ReactivateIDPRequest;
|
||||
req.setIdpId(id);
|
||||
return this.grpcService.admin.reactivateIDP(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public SearchIamMembers(
|
||||
public listIAMMembers(
|
||||
limit: number,
|
||||
offset: number,
|
||||
queryList?: IamMemberSearchQuery[],
|
||||
): Promise<IamMemberSearchResponse> {
|
||||
const req = new IamMemberSearchRequest();
|
||||
req.setLimit(limit);
|
||||
req.setOffset(offset);
|
||||
if (queryList) {
|
||||
req.setQueriesList(queryList);
|
||||
queriesList?: SearchQuery[],
|
||||
): Promise<ListIAMMembersResponse.AsObject> {
|
||||
const req = new ListIAMMembersRequest();
|
||||
const metadata = new ListQuery();
|
||||
if (limit) {
|
||||
metadata.setLimit(limit);
|
||||
}
|
||||
return this.grpcService.admin.searchIamMembers(req);
|
||||
if (offset) {
|
||||
metadata.setOffset(offset);
|
||||
}
|
||||
if (queriesList) {
|
||||
req.setQueriesList(queriesList);
|
||||
}
|
||||
req.setQuery(metadata);
|
||||
|
||||
return this.grpcService.admin.listIAMMembers(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public RemoveIamMember(
|
||||
public removeIAMMember(
|
||||
userId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new RemoveIamMemberRequest();
|
||||
): Promise<RemoveIAMMemberResponse.AsObject> {
|
||||
const req = new RemoveIAMMemberRequest();
|
||||
req.setUserId(userId);
|
||||
|
||||
return this.grpcService.admin.removeIamMember(req);
|
||||
return this.grpcService.admin.removeIAMMember(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public AddIamMember(
|
||||
public addIAMMember(
|
||||
userId: string,
|
||||
rolesList: string[],
|
||||
): Promise<IamMember> {
|
||||
const req = new AddIamMemberRequest();
|
||||
): Promise<AddIAMMemberResponse.AsObject> {
|
||||
const req = new AddIAMMemberRequest();
|
||||
req.setUserId(userId);
|
||||
req.setRolesList(rolesList);
|
||||
|
||||
return this.grpcService.admin.addIamMember(req);
|
||||
return this.grpcService.admin.addIAMMember(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
|
||||
public ChangeIamMember(
|
||||
public updateIAMMember(
|
||||
userId: string,
|
||||
rolesList: string[],
|
||||
): Promise<IamMember> {
|
||||
const req = new ChangeIamMemberRequest();
|
||||
): Promise<UpdateIAMMemberResponse.AsObject> {
|
||||
const req = new UpdateIAMMemberRequest();
|
||||
req.setUserId(userId);
|
||||
req.setRolesList(rolesList);
|
||||
|
||||
return this.grpcService.admin.changeIamMember(req);
|
||||
return this.grpcService.admin.updateIAMMember(req, null).then(resp => resp.toObject());;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,75 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { OAuthService } from 'angular-oauth2-oidc';
|
||||
import { Empty } from 'google-protobuf/google/protobuf/empty_pb';
|
||||
import { BehaviorSubject, from, merge, Observable, of, Subject } from 'rxjs';
|
||||
import { catchError, filter, finalize, first, map, mergeMap, switchMap, take, timeout } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
Changes,
|
||||
ChangesRequest,
|
||||
ExternalIDPRemoveRequest,
|
||||
ExternalIDPSearchRequest,
|
||||
ExternalIDPSearchResponse,
|
||||
Gender,
|
||||
MfaOtpResponse,
|
||||
MultiFactors,
|
||||
MyPermissions,
|
||||
MyProjectOrgSearchQuery,
|
||||
MyProjectOrgSearchRequest,
|
||||
MyProjectOrgSearchResponse,
|
||||
Org,
|
||||
PasswordChange,
|
||||
PasswordComplexityPolicy,
|
||||
UpdateUserAddressRequest,
|
||||
UpdateUserEmailRequest,
|
||||
UpdateUserPhoneRequest,
|
||||
UpdateUserProfileRequest,
|
||||
UserAddress,
|
||||
UserEmail,
|
||||
UserMembershipSearchQuery,
|
||||
UserMembershipSearchRequest,
|
||||
UserMembershipSearchResponse,
|
||||
UserPhone,
|
||||
UserProfile,
|
||||
UserProfileView,
|
||||
UserSessionViews,
|
||||
UserView,
|
||||
VerifyMfaOtp,
|
||||
VerifyUserPhoneRequest,
|
||||
VerifyWebAuthN,
|
||||
WebAuthNResponse,
|
||||
WebAuthNTokenID,
|
||||
WebAuthNTokens,
|
||||
} from '../proto/generated/auth_pb';
|
||||
AddMyAuthFactorOTPRequest,
|
||||
AddMyAuthFactorOTPResponse,
|
||||
AddMyAuthFactorU2FRequest,
|
||||
AddMyAuthFactorU2FResponse,
|
||||
AddMyPasswordlessRequest,
|
||||
AddMyPasswordlessResponse,
|
||||
GetMyEmailRequest,
|
||||
GetMyEmailResponse,
|
||||
GetMyPasswordComplexityPolicyRequest,
|
||||
GetMyPasswordComplexityPolicyResponse,
|
||||
GetMyPhoneRequest,
|
||||
GetMyPhoneResponse,
|
||||
GetMyProfileRequest,
|
||||
GetMyProfileResponse,
|
||||
GetMyUserRequest,
|
||||
GetMyUserResponse,
|
||||
ListMyAuthFactorsRequest,
|
||||
ListMyAuthFactorsResponse,
|
||||
ListMyLinkedIDPsRequest,
|
||||
ListMyLinkedIDPsResponse,
|
||||
ListMyPasswordlessRequest,
|
||||
ListMyPasswordlessResponse,
|
||||
ListMyProjectOrgsRequest,
|
||||
ListMyProjectOrgsResponse,
|
||||
ListMyUserChangesRequest,
|
||||
ListMyUserChangesResponse,
|
||||
ListMyUserGrantsRequest,
|
||||
ListMyUserGrantsResponse,
|
||||
ListMyUserSessionsRequest,
|
||||
ListMyUserSessionsResponse,
|
||||
ListMyZitadelPermissionsRequest,
|
||||
ListMyZitadelPermissionsResponse,
|
||||
RemoveMyAuthFactorOTPRequest,
|
||||
RemoveMyAuthFactorOTPResponse,
|
||||
RemoveMyAuthFactorU2FRequest,
|
||||
RemoveMyAuthFactorU2FResponse,
|
||||
RemoveMyLinkedIDPRequest,
|
||||
RemoveMyLinkedIDPResponse,
|
||||
RemoveMyPasswordlessRequest,
|
||||
RemoveMyPasswordlessResponse,
|
||||
RemoveMyPhoneRequest,
|
||||
RemoveMyPhoneResponse,
|
||||
ResendMyEmailVerificationRequest,
|
||||
ResendMyEmailVerificationResponse,
|
||||
ResendMyPhoneVerificationRequest,
|
||||
ResendMyPhoneVerificationResponse,
|
||||
SetMyEmailRequest,
|
||||
SetMyEmailResponse,
|
||||
SetMyPhoneRequest,
|
||||
SetMyPhoneResponse,
|
||||
UpdateMyPasswordRequest,
|
||||
UpdateMyPasswordResponse,
|
||||
UpdateMyProfileRequest,
|
||||
UpdateMyProfileResponse,
|
||||
VerifyMyAuthFactorOTPRequest,
|
||||
VerifyMyAuthFactorOTPResponse,
|
||||
VerifyMyAuthFactorU2FRequest,
|
||||
VerifyMyAuthFactorU2FResponse,
|
||||
VerifyMyPasswordlessRequest,
|
||||
VerifyMyPasswordlessResponse,
|
||||
VerifyMyPhoneRequest,
|
||||
VerifyMyPhoneResponse,
|
||||
} from '../proto/generated/zitadel/auth_pb';
|
||||
import { ListQuery } from '../proto/generated/zitadel/object_pb';
|
||||
import { Org, OrgQuery } from '../proto/generated/zitadel/org_pb';
|
||||
import { Gender, User, WebAuthNVerification } from '../proto/generated/zitadel/user_pb';
|
||||
import { GrpcService } from './grpc.service';
|
||||
import { StorageKey, StorageService } from './storage.service';
|
||||
|
||||
@@ -50,7 +79,7 @@ import { StorageKey, StorageService } from './storage.service';
|
||||
})
|
||||
export class GrpcAuthService {
|
||||
private _activeOrgChanged: Subject<Org.AsObject> = new Subject();
|
||||
public user!: Observable<UserProfileView.AsObject>;
|
||||
public user!: Observable<User.AsObject | undefined>;
|
||||
private zitadelPermissions: BehaviorSubject<string[]> = new BehaviorSubject(['user.resourceowner']);
|
||||
public readonly fetchedZitadelPermissions: BehaviorSubject<boolean> = new BehaviorSubject(false as boolean);
|
||||
|
||||
@@ -74,7 +103,14 @@ export class GrpcAuthService {
|
||||
).pipe(
|
||||
take(1),
|
||||
mergeMap(() => {
|
||||
return from(this.GetMyUserProfile().then(userprofile => userprofile.toObject()));
|
||||
return from(this.getMyUser().then(resp => {
|
||||
const user = resp.user;
|
||||
if (user) {
|
||||
return user;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}));
|
||||
}),
|
||||
finalize(() => {
|
||||
this.loadPermissions();
|
||||
@@ -86,7 +122,7 @@ export class GrpcAuthService {
|
||||
});
|
||||
}
|
||||
|
||||
public async GetActiveOrg(id?: string): Promise<Org.AsObject> {
|
||||
public async getActiveOrg(id?: string): Promise<Org.AsObject> {
|
||||
if (id) {
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization);
|
||||
if (org && this.cachedOrgs.find(tmp => tmp.id === org.id)) {
|
||||
@@ -96,7 +132,7 @@ export class GrpcAuthService {
|
||||
} else {
|
||||
let orgs = this.cachedOrgs;
|
||||
if (orgs.length === 0) {
|
||||
orgs = (await this.SearchMyProjectOrgs(10, 0)).toObject().resultList;
|
||||
orgs = (await this.listMyProjectOrgs(10, 0)).resultList;
|
||||
this.cachedOrgs = orgs;
|
||||
}
|
||||
|
||||
@@ -133,8 +169,8 @@ export class GrpcAuthService {
|
||||
this.activeOrgChanged.pipe(map(org => !!org)),
|
||||
]).pipe(
|
||||
first(),
|
||||
switchMap(() => from(this.GetMyzitadelPermissions())),
|
||||
map(rolesResp => rolesResp.toObject().permissionsList),
|
||||
switchMap(() => from(this.listMyZitadelPermissions())),
|
||||
map(rolesResp => rolesResp.resultList),
|
||||
catchError(_ => {
|
||||
return of([]);
|
||||
}),
|
||||
@@ -171,51 +207,56 @@ export class GrpcAuthService {
|
||||
}) > -1;
|
||||
}
|
||||
|
||||
public GetMyUserProfile(): Promise<UserProfileView> {
|
||||
return this.grpcService.auth.getMyUserProfile(new Empty());
|
||||
public getMyProfile(): Promise<GetMyProfileResponse.AsObject> {
|
||||
return this.grpcService.auth.getMyProfile(new GetMyProfileRequest(), null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyPasswordComplexityPolicy(): Promise<PasswordComplexityPolicy> {
|
||||
public getMyPasswordComplexityPolicy(): Promise<GetMyPasswordComplexityPolicyResponse.AsObject> {
|
||||
return this.grpcService.auth.getMyPasswordComplexityPolicy(
|
||||
new Empty(),
|
||||
);
|
||||
new GetMyPasswordComplexityPolicyRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyUser(): Promise<UserView> {
|
||||
public getMyUser(): Promise<GetMyUserResponse.AsObject> {
|
||||
return this.grpcService.auth.getMyUser(
|
||||
new Empty(),
|
||||
);
|
||||
new GetMyUserRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyMfas(): Promise<MultiFactors> {
|
||||
return this.grpcService.auth.getMyMfas(
|
||||
new Empty(),
|
||||
);
|
||||
public listMyMultiFactors(): Promise<ListMyAuthFactorsResponse.AsObject> {
|
||||
return this.grpcService.auth.listMyAuthFactors(
|
||||
new ListMyAuthFactorsRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SearchMyProjectOrgs(
|
||||
public listMyProjectOrgs(
|
||||
limit: number,
|
||||
offset: number,
|
||||
queryList?: MyProjectOrgSearchQuery[],
|
||||
): Promise<MyProjectOrgSearchResponse> {
|
||||
const req: MyProjectOrgSearchRequest = new MyProjectOrgSearchRequest();
|
||||
req.setOffset(offset);
|
||||
req.setLimit(limit);
|
||||
queryList?: OrgQuery[],
|
||||
): Promise<ListMyProjectOrgsResponse.AsObject> {
|
||||
const req = new ListMyProjectOrgsRequest();
|
||||
const metadata = new ListQuery();
|
||||
if (offset) {
|
||||
metadata.setOffset(offset);
|
||||
}
|
||||
if (limit) {
|
||||
metadata.setLimit(limit);
|
||||
}
|
||||
if (queryList) {
|
||||
req.setQueriesList(queryList);
|
||||
}
|
||||
|
||||
return this.grpcService.auth.searchMyProjectOrgs(req);
|
||||
return this.grpcService.auth.listMyProjectOrgs(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SaveMyUserProfile(
|
||||
public updateMyProfile(
|
||||
firstName?: string,
|
||||
lastName?: string,
|
||||
nickName?: string,
|
||||
preferredLanguage?: string,
|
||||
gender?: Gender,
|
||||
): Promise<UserProfile> {
|
||||
const req = new UpdateUserProfileRequest();
|
||||
): Promise<UpdateMyProfileResponse.AsObject> {
|
||||
const req = new UpdateMyProfileRequest();
|
||||
if (firstName) {
|
||||
req.setFirstName(firstName);
|
||||
}
|
||||
@@ -231,202 +272,195 @@ export class GrpcAuthService {
|
||||
if (preferredLanguage) {
|
||||
req.setPreferredLanguage(preferredLanguage);
|
||||
}
|
||||
return this.grpcService.auth.updateMyUserProfile(req);
|
||||
return this.grpcService.auth.updateMyProfile(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public get zitadelPermissionsChanged(): Observable<string[]> {
|
||||
return this.zitadelPermissions;
|
||||
}
|
||||
|
||||
public getMyUserSessions(): Promise<UserSessionViews> {
|
||||
return this.grpcService.auth.getMyUserSessions(
|
||||
new Empty(),
|
||||
);
|
||||
public listMyUserSessions(): Promise<ListMyUserSessionsResponse.AsObject> {
|
||||
const req = new ListMyUserSessionsRequest();
|
||||
return this.grpcService.auth.listMyUserSessions(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SearchUserMemberships(limit: number, offset: number, queryList?: UserMembershipSearchQuery[]): Promise<UserMembershipSearchResponse> {
|
||||
const req = new UserMembershipSearchRequest();
|
||||
req.setLimit(limit);
|
||||
req.setOffset(offset);
|
||||
if (queryList) {
|
||||
req.setQueriesList(queryList);
|
||||
public listMyUserGrants(limit?: number, offset?: number, queryList?: ListQuery[]): Promise<ListMyUserGrantsResponse.AsObject> {
|
||||
const req = new ListMyUserGrantsRequest();
|
||||
const query = new ListQuery();
|
||||
if (limit) {
|
||||
query.setLimit(limit);
|
||||
}
|
||||
return this.grpcService.auth.searchMyUserMemberships(req);
|
||||
if (offset) {
|
||||
query.setOffset(offset);
|
||||
}
|
||||
req.setQuery(query);
|
||||
return this.grpcService.auth.listMyUserGrants(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyUserEmail(): Promise<UserEmail> {
|
||||
return this.grpcService.auth.getMyUserEmail(
|
||||
new Empty(),
|
||||
);
|
||||
public getMyEmail(): Promise<GetMyEmailResponse.AsObject> {
|
||||
const req = new GetMyEmailRequest();
|
||||
return this.grpcService.auth.getMyEmail(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SaveMyUserEmail(email: string): Promise<UserEmail> {
|
||||
const req = new UpdateUserEmailRequest();
|
||||
public setMyEmail(email: string): Promise<SetMyEmailResponse.AsObject> {
|
||||
const req = new SetMyEmailRequest();
|
||||
req.setEmail(email);
|
||||
return this.grpcService.auth.changeMyUserEmail(req);
|
||||
return this.grpcService.auth.setMyEmail(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public ResendMyEmailVerificationMail(): Promise<Empty> {
|
||||
return this.grpcService.auth.resendMyEmailVerificationMail(
|
||||
new Empty(),
|
||||
);
|
||||
public resendMyEmailVerification(): Promise<ResendMyEmailVerificationResponse.AsObject> {
|
||||
const req = new ResendMyEmailVerificationRequest();
|
||||
return this.grpcService.auth.resendMyEmailVerification(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public RemoveMyUserPhone(): Promise<Empty> {
|
||||
return this.grpcService.auth.removeMyUserPhone(
|
||||
new Empty(),
|
||||
);
|
||||
public removeMyPhone(): Promise<RemoveMyPhoneResponse.AsObject> {
|
||||
return this.grpcService.auth.removeMyPhone(
|
||||
new RemoveMyPhoneRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyzitadelPermissions(): Promise<MyPermissions> {
|
||||
return this.grpcService.auth.getMyZitadelPermissions(
|
||||
new Empty(),
|
||||
);
|
||||
public listMyZitadelPermissions(): Promise<ListMyZitadelPermissionsResponse.AsObject> {
|
||||
return this.grpcService.auth.listMyZitadelPermissions(
|
||||
new ListMyZitadelPermissionsRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyUserPhone(): Promise<UserPhone> {
|
||||
return this.grpcService.auth.getMyUserPhone(
|
||||
new Empty(),
|
||||
);
|
||||
public getMyPhone(): Promise<GetMyPhoneResponse.AsObject> {
|
||||
return this.grpcService.auth.getMyPhone(
|
||||
new GetMyPhoneRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SaveMyUserPhone(phone: string): Promise<UserPhone> {
|
||||
const req = new UpdateUserPhoneRequest();
|
||||
public setMyPhone(phone: string): Promise<SetMyPhoneResponse.AsObject> {
|
||||
const req = new SetMyPhoneRequest();
|
||||
req.setPhone(phone);
|
||||
return this.grpcService.auth.changeMyUserPhone(req);
|
||||
return this.grpcService.auth.setMyPhone(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyUserAddress(): Promise<UserAddress> {
|
||||
return this.grpcService.auth.getMyUserAddress(
|
||||
new Empty(),
|
||||
);
|
||||
public resendMyPhoneVerification(): Promise<ResendMyPhoneVerificationResponse.AsObject> {
|
||||
const req = new ResendMyPhoneVerificationRequest();
|
||||
return this.grpcService.auth.resendMyPhoneVerification(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public ResendEmailVerification(): Promise<Empty> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.auth.resendMyEmailVerificationMail(req);
|
||||
}
|
||||
|
||||
public ResendPhoneVerification(): Promise<Empty> {
|
||||
const req = new Empty();
|
||||
return this.grpcService.auth.resendMyPhoneVerificationCode(req);
|
||||
}
|
||||
|
||||
public ChangeMyPassword(oldPassword: string, newPassword: string): Promise<Empty> {
|
||||
const req = new PasswordChange();
|
||||
public updateMyPassword(oldPassword: string, newPassword: string): Promise<UpdateMyPasswordResponse.AsObject> {
|
||||
const req = new UpdateMyPasswordRequest();
|
||||
req.setOldPassword(oldPassword);
|
||||
req.setNewPassword(newPassword);
|
||||
return this.grpcService.auth.changeMyPassword(req);
|
||||
return this.grpcService.auth.updateMyPassword(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public RemoveExternalIDP(
|
||||
public removeMyLinkedIDP(
|
||||
externalUserId: string,
|
||||
idpConfigId: string,
|
||||
): Promise<Empty> {
|
||||
const req = new ExternalIDPRemoveRequest();
|
||||
req.setExternalUserId(externalUserId);
|
||||
req.setIdpConfigId(idpConfigId);
|
||||
return this.grpcService.auth.removeMyExternalIDP(req);
|
||||
idpId: string,
|
||||
): Promise<RemoveMyLinkedIDPResponse.AsObject> {
|
||||
const req = new RemoveMyLinkedIDPRequest();
|
||||
req.setLinkedUserId(externalUserId);
|
||||
req.setIdpId(idpId);
|
||||
return this.grpcService.auth.removeMyLinkedIDP(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SearchMyExternalIdps(
|
||||
public listMyLinkedIDPs(
|
||||
limit: number,
|
||||
offset: number,
|
||||
): Promise<ExternalIDPSearchResponse> {
|
||||
const req = new ExternalIDPSearchRequest();
|
||||
req.setLimit(limit);
|
||||
req.setOffset(offset);
|
||||
return this.grpcService.auth.searchMyExternalIDPs(req);
|
||||
): Promise<ListMyLinkedIDPsResponse.AsObject> {
|
||||
const req = new ListMyLinkedIDPsRequest();
|
||||
const metadata = new ListQuery();
|
||||
if (limit) {
|
||||
metadata.setLimit(limit);
|
||||
}
|
||||
if (offset) {
|
||||
metadata.setOffset(offset);
|
||||
}
|
||||
req.setQuery(metadata);
|
||||
return this.grpcService.auth.listMyLinkedIDPs(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public AddMfaOTP(): Promise<MfaOtpResponse> {
|
||||
return this.grpcService.auth.addMfaOTP(
|
||||
new Empty(),
|
||||
);
|
||||
public addMyMultiFactorOTP(): Promise<AddMyAuthFactorOTPResponse.AsObject> {
|
||||
return this.grpcService.auth.addMyAuthFactorOTP(
|
||||
new AddMyAuthFactorOTPRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public AddMyMfaU2F(): Promise<WebAuthNResponse> {
|
||||
return this.grpcService.auth.addMyMfaU2F(
|
||||
new Empty(),
|
||||
);
|
||||
public addMyMultiFactorU2F(): Promise<AddMyAuthFactorU2FResponse.AsObject> {
|
||||
return this.grpcService.auth.addMyAuthFactorU2F(
|
||||
new AddMyAuthFactorU2FRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public RemoveMyMfaU2F(id: string): Promise<Empty> {
|
||||
const req = new WebAuthNTokenID();
|
||||
req.setId(id);
|
||||
return this.grpcService.auth.removeMyMfaU2F(req);
|
||||
public removeMyMultiFactorU2F(tokenId: string): Promise<RemoveMyAuthFactorU2FResponse.AsObject> {
|
||||
const req = new RemoveMyAuthFactorU2FRequest();
|
||||
req.setTokenId(tokenId);
|
||||
return this.grpcService.auth.removeMyAuthFactorU2F(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public VerifyMyMfaU2F(credential: string, tokenname: string): Promise<Empty> {
|
||||
const req = new VerifyWebAuthN();
|
||||
req.setPublicKeyCredential(credential);
|
||||
req.setTokenName(tokenname);
|
||||
public verifyMyMultiFactorU2F(credential: string, tokenname: string): Promise<VerifyMyAuthFactorU2FResponse.AsObject> {
|
||||
const req = new VerifyMyAuthFactorU2FRequest();
|
||||
const verification = new WebAuthNVerification();
|
||||
verification.setPublicKeyCredential(credential);
|
||||
verification.setTokenName(tokenname);
|
||||
req.setVerification(verification);
|
||||
|
||||
return this.grpcService.auth.verifyMyMfaU2F(
|
||||
req,
|
||||
);
|
||||
return this.grpcService.auth.verifyMyAuthFactorU2F(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public GetMyPasswordless(): Promise<WebAuthNTokens> {
|
||||
return this.grpcService.auth.getMyPasswordless(
|
||||
new Empty(),
|
||||
);
|
||||
public listMyPasswordless(): Promise<ListMyPasswordlessResponse.AsObject> {
|
||||
return this.grpcService.auth.listMyPasswordless(
|
||||
new ListMyPasswordlessRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public AddMyPasswordless(): Promise<WebAuthNResponse> {
|
||||
public addMyPasswordless(): Promise<AddMyPasswordlessResponse.AsObject> {
|
||||
return this.grpcService.auth.addMyPasswordless(
|
||||
new Empty(),
|
||||
);
|
||||
new AddMyPasswordlessRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public RemoveMyPasswordless(id: string): Promise<Empty> {
|
||||
const req = new WebAuthNTokenID();
|
||||
req.setId(id);
|
||||
return this.grpcService.auth.removeMyPasswordless(req);
|
||||
public removeMyPasswordless(tokenId: string): Promise<RemoveMyPasswordlessResponse.AsObject> {
|
||||
const req = new RemoveMyPasswordlessRequest();
|
||||
req.setTokenId(tokenId);
|
||||
return this.grpcService.auth.removeMyPasswordless(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public verifyMyPasswordless(credential: string, tokenname: string): Promise<Empty> {
|
||||
const req = new VerifyWebAuthN();
|
||||
req.setPublicKeyCredential(credential);
|
||||
req.setTokenName(tokenname);
|
||||
public verifyMyPasswordless(credential: string, tokenname: string): Promise<VerifyMyPasswordlessResponse.AsObject> {
|
||||
const req = new VerifyMyPasswordlessRequest();
|
||||
const verification = new WebAuthNVerification();
|
||||
verification.setTokenName(tokenname);
|
||||
verification.setPublicKeyCredential(credential);
|
||||
req.setVerification(verification);
|
||||
|
||||
return this.grpcService.auth.verifyMyPasswordless(
|
||||
req,
|
||||
);
|
||||
req, null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public RemoveMfaOTP(): Promise<Empty> {
|
||||
return this.grpcService.auth.removeMfaOTP(
|
||||
new Empty(),
|
||||
);
|
||||
public removeMyMultiFactorOTP(): Promise<RemoveMyAuthFactorOTPResponse.AsObject> {
|
||||
return this.grpcService.auth.removeMyAuthFactorOTP(
|
||||
new RemoveMyAuthFactorOTPRequest(), null
|
||||
).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public VerifyMfaOTP(code: string): Promise<Empty> {
|
||||
const req = new VerifyMfaOtp();
|
||||
public verifyMyMultiFactorOTP(code: string): Promise<VerifyMyAuthFactorOTPResponse.AsObject> {
|
||||
const req = new VerifyMyAuthFactorOTPRequest();
|
||||
req.setCode(code);
|
||||
return this.grpcService.auth.verifyMfaOTP(req);
|
||||
return this.grpcService.auth.verifyMyAuthFactorOTP(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public VerifyMyUserPhone(code: string): Promise<Empty> {
|
||||
const req = new VerifyUserPhoneRequest();
|
||||
public verifyMyPhone(code: string): Promise<VerifyMyPhoneResponse.AsObject> {
|
||||
const req = new VerifyMyPhoneRequest();
|
||||
req.setCode(code);
|
||||
return this.grpcService.auth.verifyMyUserPhone(req);
|
||||
return this.grpcService.auth.verifyMyPhone(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
|
||||
public SaveMyUserAddress(address: UserAddress.AsObject): Promise<UserAddress> {
|
||||
const req = new UpdateUserAddressRequest();
|
||||
req.setStreetAddress(address.streetAddress);
|
||||
req.setPostalCode(address.postalCode);
|
||||
req.setLocality(address.locality);
|
||||
req.setRegion(address.region);
|
||||
req.setCountry(address.country);
|
||||
return this.grpcService.auth.updateMyUserAddress(req);
|
||||
}
|
||||
|
||||
public GetMyUserChanges(limit: number, sequenceoffset: number): Promise<Changes> {
|
||||
const req = new ChangesRequest();
|
||||
req.setLimit(limit);
|
||||
req.setSequenceOffset(sequenceoffset);
|
||||
return this.grpcService.auth.getMyUserChanges(req);
|
||||
public listMyUserChanges(limit: number, offset: number): Promise<ListMyUserChangesResponse.AsObject> {
|
||||
const req = new ListMyUserChangesRequest();
|
||||
const query = new ListQuery();
|
||||
if (limit) {
|
||||
query.setLimit(limit);
|
||||
}
|
||||
if (offset) {
|
||||
query.setOffset(offset);
|
||||
}
|
||||
req.setQuery(query);
|
||||
return this.grpcService.auth.listMyUserChanges(req, null).then(resp => resp.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { AuthConfig } from 'angular-oauth2-oidc';
|
||||
|
||||
import { AdminServicePromiseClient } from '../proto/generated/admin_grpc_web_pb';
|
||||
import { AuthServicePromiseClient } from '../proto/generated/auth_grpc_web_pb';
|
||||
import { ManagementServicePromiseClient } from '../proto/generated/management_grpc_web_pb';
|
||||
import { AdminServiceClient } from '../proto/generated/zitadel/AdminServiceClientPb';
|
||||
import { AuthServiceClient } from '../proto/generated/zitadel/AuthServiceClientPb';
|
||||
import { ManagementServiceClient } from '../proto/generated/zitadel/ManagementServiceClientPb';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
||||
import { I18nInterceptor } from './interceptors/i18n.interceptor';
|
||||
@@ -17,9 +17,9 @@ import { StorageService } from './storage.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GrpcService {
|
||||
public auth!: AuthServicePromiseClient;
|
||||
public mgmt!: ManagementServicePromiseClient;
|
||||
public admin!: AdminServicePromiseClient;
|
||||
public auth!: AuthServiceClient;
|
||||
public mgmt!: ManagementServiceClient;
|
||||
public admin!: AdminServiceClient;
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@@ -42,19 +42,19 @@ export class GrpcService {
|
||||
],
|
||||
};
|
||||
|
||||
this.auth = new AuthServicePromiseClient(
|
||||
this.auth = new AuthServiceClient(
|
||||
data.authServiceUrl,
|
||||
null,
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
this.mgmt = new ManagementServicePromiseClient(
|
||||
this.mgmt = new ManagementServiceClient(
|
||||
data.mgmtServiceUrl,
|
||||
null,
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
this.admin = new AdminServicePromiseClient(
|
||||
this.admin = new AdminServiceClient(
|
||||
// TODO: replace with service url
|
||||
data.mgmtServiceUrl,
|
||||
null,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Request, UnaryInterceptor, UnaryResponse } from 'grpc-web';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { Org } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
|
||||
import { StorageService } from '../storage.service';
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user