Class: UserLoginData
model/postgres/UserLoginData.entity.UserLoginData
Entity for representing the authenticatoin of a user using onme strategy instance
It contains the data needed to identify a user if they tries to log in (e.g. username/id on 3rd party service). For example password for username/password auth or the username for GitHub auth
Constructors
constructor
• new UserLoginData()
Properties
data
• data: any
Data which needs to be stored for the user for every strategy he uses (e.g. username on the 3rd party platform, password for userpass).
The exact data and structure stored depends on the strategy and their usage. It will be set on initial registration of a authentication and not changed afterwards.
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:77
expires
• expires: Date
If not null
, this authentication should be considered invalid on any date+time AFTER this.
This is to ensure created UserLoginData, that are not used for registration
or linking in time, are not kept forever.
If null
, the authentication should not expire by date.
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:104
id
• id: string
The unique ID of this login data
Example
12345678-90ab-cdef-fedc-ab0987654321
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:45
imsUsers
• imsUsers: Promise
<UserLoginDataImsUser
[]>
All IMSUser instances in the backend that are represented by this authentication.
These are all users in an IMS that are represented by the strategy instance of this that match the needed data for this user. If a request for an access token for any of these IMS users comes in, the best token from all logins of this authenticaiton will be returned.
IMSUsers are added when:
- a sync service sends the information, that a IMSUser was created
- a user registeres (or logs in) using this authentication and new matching IMSUsers are found
- a user registeres (or logs in) using this authentication and an IMS is found on which no IMSUser for this authentication is found.
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:122
loginsUsingThis
• loginsUsingThis: Promise
<ActiveLogin
[]>
A list of all login events that used this authentication.
Every time the user logs in or registers a new login instance will be saved.
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:131
state
• state: LoginState
The state this authentication is in.
Rules:
- Only UserLoginData in state LoginState.VALID may be used for login and retrieving an access token.
- Only UserLoginData in state LoginState.WAITING_FOR_REGISTER may be used for registration or linking.
- UserLoginData in state LoginState.BLOCKED cannot be used for anything
Example
"VALID"
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:94
strategyInstance
• strategyInstance: Promise
<StrategyInstance
>
The strategy instance this authentication uses.
For example a UserLoginData containing a password would reference a strategy instance of type userpass
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:66
user
• user: Promise
<LoginUser
>
The user that is represented by this authentication. Will be set once a user has been crated or linked for the new authentication. Null before that.
If this authentication is used to login, this is the user which should be logged in.
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:56
Methods
toJSON
▸ toJSON(): Object
Returns
Object
Name | Type |
---|---|
expires | Date |
id | string |
state | LoginState |
Defined in
login-service/src/model/postgres/UserLoginData.entity.ts:133