-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(service): users/auth: refactor some app level logic to inter…
…nal/domain services for reuse
- Loading branch information
Showing
7 changed files
with
141 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
import { User } from '../entities/users/entities.users' | ||
import { UserExpanded } from '../entities/users/entities.users' | ||
import { IdentityProvider, IdentityProviderUser, UserIngressBindings } from './ingress.entities' | ||
|
||
export type AdmissionResult = | ||
| { | ||
/** | ||
* `'admitted'` if the user account is valid for admission and access to Mage, `'denied'` otherwise | ||
*/ | ||
action: 'admitted', | ||
/** | ||
* The existing or newly enrolled Mage account | ||
*/ | ||
mageAccount: UserExpanded, | ||
/** | ||
* Whether the admission resulted in a new Mage account enrollment | ||
*/ | ||
enrolled: boolean, | ||
} | ||
| { | ||
action: 'denied', | ||
reason: AdmissionDeniedReason, | ||
mageAccount: UserExpanded | null, | ||
enrolled: boolean, | ||
} | ||
|
||
export enum AdmissionDeniedReason { | ||
PendingApproval = 'PendingApproval', | ||
Disabled = 'Disabled', | ||
NameConflict = 'NameConflict', | ||
InternalError = 'InternalError', | ||
} | ||
|
||
export interface AdmitUserFromIdentityProviderAccount { | ||
(idpAccount: IdentityProviderUser, idp: IdentityProvider): Promise<AdmissionResult> | ||
} | ||
|
||
export interface EnrollNewUser { | ||
(idpAccount: IdentityProviderUser, idp: IdentityProvider): Promise<{ mageAccount: User, ingressBindings: UserIngressBindings }> | ||
(idpAccount: IdentityProviderUser, idp: IdentityProvider): Promise<{ mageAccount: UserExpanded, ingressBindings: UserIngressBindings }> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters