# 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 (authMockoptboolean) → string instance

Return authorization header

Arguments:
  
      $App.connection.authorize().then(function(session){
  return {Authorization: session.authHeader()}
})
  

# crc32 (sstring, polynomialoptnumber, initialValueoptnumber, finalXORValueoptnumber) → number instance

Calculate CRC32 checksum for UTF8 string representation

Arguments:
  • s: string

    string to calculate CRC32

  • polynomial: number

    polynomial basis. default to 0x04C11DB7

  • initialValue: number

    initial crc value. default to 0xFFFFFFFF

  • finalXORValue: number

    default to 0xFFFFFFFF

# 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 (valuestring) → string instance

Return hexadecimal string of 8 character length from value

Arguments:

# isAnonymous () → boolean instance

Current session is anonymous session

# signature (authMockoptboolean) → string instance

Session signature for authorized request. Can be added as LAST parameter in url, or to Authorization header (preferred way)

Arguments:
  
      $App.connection.authorize().then(function(session) {
       // for URL
       return 'session_signature=' + session.signature()
       //for header
       return { Authorization: session.authSchema + ' ' + session.signature() }
   })