Class: RegisterController
api-login/register.controller.RegisterController
Controller for handling self registration of new users as well as linking of existing users to new loginData
Constructors
constructor
• new RegisterController(checkRegistrationTokenService
, loginDataService
, userService
, activeLoginService
, backendUserSerivce
, strategiesSerivce
)
Parameters
Name | Type |
---|---|
checkRegistrationTokenService | CheckRegistrationTokenService |
loginDataService | UserLoginDataService |
userService | LoginUserService |
activeLoginService | ActiveLoginService |
backendUserSerivce | BackendUserService |
strategiesSerivce | StrategiesService |
Defined in
login-service/src/api-login/register.controller.ts:34
Properties
activeLoginService
• Private
Readonly
activeLoginService: ActiveLoginService
Defined in
login-service/src/api-login/register.controller.ts:38
backendUserSerivce
• Private
Readonly
backendUserSerivce: BackendUserService
Defined in
login-service/src/api-login/register.controller.ts:39
checkRegistrationTokenService
• Private
Readonly
checkRegistrationTokenService: CheckRegistrationTokenService
Defined in
login-service/src/api-login/register.controller.ts:35
loginDataService
• Private
Readonly
loginDataService: UserLoginDataService
Defined in
login-service/src/api-login/register.controller.ts:36
strategiesSerivce
• Private
Readonly
strategiesSerivce: StrategiesService
Defined in
login-service/src/api-login/register.controller.ts:40
userService
• Private
Readonly
userService: LoginUserService
Defined in
login-service/src/api-login/register.controller.ts:37
Methods
adminLink
▸ adminLink(input
, res
): Promise
<DefaultReturn
>
Links a new authentication with any user specified by id
Needs admin permissions
A (still) valid registration token is needed. After a successful linking, the expiration of the activeLogin and loginData will be updated accoringly
Parameters
Name | Type | Description |
---|---|---|
input | AdminLinkUserInput | The input with the registration_token and the user id of the user to link |
res | Response <any , Record <string , any >> | The response object of the server containing the state with the logged in user |
Returns
Promise
<DefaultReturn
>
The default response with operation 'admin-link'
Defined in
login-service/src/api-login/register.controller.ts:205
getDataSuggestions
▸ getDataSuggestions(input
): Promise
<UserDataSuggestionResponse
>
Return username, display name and email suggestions for registering a user
Parameters
Name | Type | Description |
---|---|---|
input | RegistrationTokenInput | The input data containing the registration token to retrieve suggestions for |
Returns
Promise
<UserDataSuggestionResponse
>
Defined in
login-service/src/api-login/register.controller.ts:60
linkAccountToUser
▸ Private
linkAccountToUser(userToLinkTo
, loginData
, activeLogin
): Promise
<{ loggedInUser
: LoginUser
; loginData
: UserLoginData
}>
Helper function performing tha actual linking of login data with user.
If the given login data already has a user set, the user must match the given one, else a INTERNAL_SERVER_ERROR is raised.
The expiration of the loginData will be removed. The expiration of the activeLogin will be set to the default login expiration time, except if the strategy supports sync, then the active login will never expire. The state of the loginData will be updated to VALID if it was WAITING_FOR_REGISER before
Parameters
Name | Type | Description |
---|---|---|
userToLinkTo | LoginUser | The user account to link the new authentication to |
loginData | UserLoginData | The new authentication to link to the user |
activeLogin | ActiveLogin | The active login that was created during the authentication flow |
Returns
Promise
<{ loggedInUser
: LoginUser
; loginData
: UserLoginData
}>
The saved and updated user and login data after linking
Defined in
login-service/src/api-login/register.controller.ts:242
register
▸ register(input
): Promise
<DefaultReturn
>
Given user data and a registration token, this will create a new user for the registration. The user will also be created in the backend.
For the creation to succeed, the registration token and the registration may not be expired yet.
Parameters
Name | Type | Description |
---|---|---|
input | SelfRegisterUserInput | The input data for creating a new user |
Returns
Promise
<DefaultReturn
>
The default return with operation "self-register"
Defined in
login-service/src/api-login/register.controller.ts:121
selfLink
▸ selfLink(input
, res
): Promise
<DefaultReturn
>
Links a new authentication with a strategy instance with the currently logged in user. For future logins using that authentication the user will be directly found
A (still) valid registration token is needed. After a successful linking, the expiration of the activeLogin and loginData will be updated accoringly
Parameters
Name | Type | Description |
---|---|---|
input | RegistrationTokenInput | The input containing the registration token obtained from the authentication flow |
res | Response <any , Record <string , any >> | The response object of the server containing the state with the logged in user |
Returns
Promise
<DefaultReturn
>
The default response with operation 'self-link'