Class: ActiveLogin
model/postgres/ActiveLogin.entity.ActiveLogin
Entity representing a single login event by one user using a specific strategy.
This object contains the data specific to this login event (e.g. tokens, ...). It also saves the login time and other meta data needed to keep track of the login.
It can be invalidated by flag or expiration date
Constructors
constructor
• new ActiveLogin(usedStrategyInstance
, expires?
)
Parameters
Name | Type |
---|---|
usedStrategyInstance | StrategyInstance |
expires? | Date |
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:20
Properties
created
• created: Date
The date+time at which the user logged in, creating this event. Can be the time the authentication request was submitted or the time the access token was retrieved
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:41
createdByClient
• createdByClient: Promise
<AuthClient
>
The auth client that asked for the user to be authenticated and caused the creation of this login event.
May be null on creation of the login event and may be set only once token is retrieved.
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:131
data
• data: object
= {}
Data which needs to be stored on a per-login basis (e.g. issued tokens from auth provider)
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:98
expires
• expires: Date
If not null
, this login should be considered invalid on any date+time AFTER this.
This is to ensure logout and time restrict registration etc.
If null
, the login should not expire by date.
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:50
id
• id: string
The unique ID of this active login
Example
12345678-90ab-cdef-fedc-ab0987654321
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:34
isValid
• isValid: boolean
Whether this login is valid to be used.
If false
it should be considered invalid (just like expired) and no new tokens issued for it.
Example
true
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:59
loginInstanceFor
• loginInstanceFor: Promise
<UserLoginData
>
The loginData
that represents the authentication of a user using one strategy.
This login event is one event instance of this authentication.
Should be set as soon as possible and should not be changed afterwards.
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:120
nextExpectedRefreshTokenNumber
• nextExpectedRefreshTokenNumber: number
The numeric identifier of the last refresh token given out (the next one expected).
ONLY the token with this id should be accepted as refresh token for this login event. If a valid token with an older id is used, this login event should be made invalid, as it is a reuse of the refresh token, which likely means it has been abused.
For a new instance this starts at LOGGED_IN_BUT_TOKEN_NOT_YET_RETRIVED=-1 and gets incremented once the first refresh token is created.
Example
0
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:91
supportsSync
• supportsSync: boolean
Whether this login events data can be used for sync by the sync service.
Should be true
for logins created with REGISTER_SYNC function, false
otherwise
If true
, the data (e.g. the token) will be passed to tke sync service
upon request for a IMSUser to be used to write onto that IMS in the users name
If false
, this login will be skipped in te search for a token.
Example
false
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:73
usedStrategyInstnce
• usedStrategyInstnce: Promise
<StrategyInstance
>
The strategy instance that this login event used
May not be null, must be set on creation.
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:107
LOGGED_IN_BUT_TOKEN_NOT_YET_RETRIVED
▪ Static
LOGGED_IN_BUT_TOKEN_NOT_YET_RETRIVED: number
= -1
Defined in
login-service/src/model/postgres/ActiveLogin.entity.ts:18
Methods
toJSON
▸ toJSON(): Object
Returns
Object
Name | Type |
---|---|
created | Date |
id | string |
isValid | Date |
requiresSecret | boolean |