# new UBSession ()
Members
# authSchema : string instance
Name of authentication schema
# userData : object instance
Contain custom user data. Usually filled inside server onUserLogon
event handlers
Do not use it directly, instead use helper method SyncConnection.userData() instead.
# oidcTokensSetTime : number inner
Milliseconds since epoch when oidcTokens is assigned. Used to check we need refresh access_token
Methods
# authHeader (authMockopt: boolean) → string instance
Return authorization header
Arguments:
authMock
= false: boolean
$App.connection.authorize().then(function(session){
return {Authorization: session.authHeader()}
})
# crc32 (s: string, polynomialopt: number, initialValueopt: number, finalXORValueopt: number) → number instance
Calculate CRC32 checksum for UTF8 string representation
# getOidcAuth () → string | null instance
Returns value for Authorization header, what contains token previously obtained from OIDC authentication. Such authorization can be used to request the external resources, what uses the same OIDC provider
Return:
Either string what should be used as Authorization header value or null in case OIDC token is not initialized
UB.connection.authorize().then(session => session.getOidcAuth()).then(UB.logDebug) // 'Bearer .....'
# hexa8 (value: string) → string instance
Return hexadecimal string of 8 character length from value
# isAnonymous () → boolean instance
Current session is anonymous session
# signature (authMockopt: boolean) → string instance
Session signature for authorized request. Can be added as LAST parameter in url, or to Authorization header (preferred way)
Arguments:
authMock
: boolean
$App.connection.authorize().then(function(session) {
// for URL
return 'session_signature=' + session.signature()
//for header
return { Authorization: session.authSchema + ' ' + session.signature() }
})