Skip to main content

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

NameType
usedStrategyInstanceStrategyInstance
expires?Date

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:18

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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:39


data

data: object = {}

Data which needs to be stored on a per-login basis (e.g. issued tokens from auth provider)

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:96


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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:48


id

id: string

The unique ID of this active login

Example

12345678-90ab-cdef-fedc-ab0987654321

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:32


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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:57


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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:118


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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:89


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

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:71


usedStrategyInstance

usedStrategyInstance: Promise<StrategyInstance>

The strategy instance that this login event used

May not be null, must be set on creation.

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:105


LOGGED_IN_BUT_TOKEN_NOT_YET_RETRIVED

Static LOGGED_IN_BUT_TOKEN_NOT_YET_RETRIVED: number = -1

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:16

Methods

toJSON

toJSON(): Object

Returns

Object

NameType
createdDate
exporesDate
idstring
isValidboolean
supportsSyncboolean

Defined in

gropius-login-service/backend/src/model/postgres/ActiveLogin.entity.ts:120