Options
All
  • Public
  • Public/Protected
  • All
Menu

Module auth

Authentication

There are two methods that can be used when sending authenticated requests to the MapLarge API. Using the user name and password, a temporary access token can be requested then used with subsequent requests, or each request can be accompanied by user name and password.

Which method should you use?

Both methods are very similar. The only difference is that tokens will expire in the future and your password can only be changed manually. This is a security advantage when using a token compared to using your password directly.

Requesting a Token

Tokens work just like a password so they should be stored securely. Access tokens may expire at any time in the future. In this example, ml.auth.login function is used to authenticate with the MapLarge API Server and return the token. This function will store the authenticated user name and token in the JavaScript API for future use.

var username = "testuser@maplarge.com",
    password = "testpassword",
    token = null;

ml.auth.login(username, password, function(response) {
    if (response.success === true) {
        // our login was successful, let's store our token for future use
        token = response.token;
    } else {
        // our login was not successful, do something else ...
    }
});

Index

Variables

accounts

accounts: string[]

authLoginComponent

authLoginComponent: any

authStatusChangeEvent

authStatusChangeEvent: string

currentUserInfo

currentUserInfo: UserInfo

fxqueue

fxqueue: function

Queue of callback functions to execute after successful authentication.

Type declaration

    • (): void[]
    • Returns void[]

loginDialogOpen

loginDialogOpen: boolean

Are we currently in an authentication process?

loginQueue

loginQueue: object

Type declaration

  • [key: string]: function
      • (response: any): void
      • Parameters

        • response: any

        Returns void

txtboxPass

txtboxPass: any

txtboxUser

txtboxUser: any

Functions

call

  • call(action: any, params: any, callback: any, credentials: any): void
  • Parameters

    • action: any
    • params: any
    • callback: any
    • credentials: any

    Returns void

getAuthServer

  • getAuthServer(): any
  • Returns any

hideAuthLogin

  • hideAuthLogin(): void
  • Returns void

isAccountEditor

  • isAccountEditor(callback: function, accountName: string): void
  • Parameters

    • callback: function
        • (result: boolean): void
        • Parameters

          • result: boolean

          Returns void

    • accountName: string

    Returns void

isAuthenticated

  • isAuthenticated(user?: string, token?: string): boolean
  • Parameters

    • Optional user: string
    • Optional token: string

    Returns boolean

isMemberOfGroup

  • isMemberOfGroup(groups: string[], callback: function): void
  • Parameters

    • groups: string[]
    • callback: function
        • (result: boolean): void
        • Parameters

          • result: boolean

          Returns void

    Returns void

isSysAdmin

  • isSysAdmin(callback: function): void
  • Parameters

    • callback: function
        • (result: boolean): void
        • Parameters

          • result: boolean

          Returns void

    Returns void

isUserInfoAccountEditor

  • isUserInfoAccountEditor(userInfo: UserInfo, accountName: string): boolean
  • Parameters

    • userInfo: UserInfo
    • accountName: string

    Returns boolean

isUserInfoMemberOfGroup

  • isUserInfoMemberOfGroup(userInfo: UserInfo, groups: string[]): boolean
  • Parameters

    Returns boolean

isUserInfoSysAdmin

  • isUserInfoSysAdmin(userInfo: UserInfo): boolean
  • Parameters

    Returns boolean

login

  • login(user?: string, pass?: string, callback?: function): void
  • Parameters

    • Optional user: string
    • Optional pass: string
    • Optional callback: function
        • (response: any): void
        • Parameters

          • response: any

          Returns void

    Returns void

logout

  • logout(callback?: any): void
  • Parameters

    • Optional callback: any

    Returns void

setToken

  • setToken(user: string, token: string, callback?: function): void
  • Parameters

    Returns void

showlogin

  • showlogin(callbackQueue?: function, loginBoxMessage?: string): void
  • Show UI login dialog and process the default login queue along with the optional additional queue, on success.

    Parameters

    • Optional callbackQueue: function

      An array of functions to be executed on success

        • (): void[]
        • Returns void[]

    • Optional loginBoxMessage: string

    Returns void

verifycred

  • verifycred(callback: any, loginBoxMessage?: string): void
  • Parameters

    • callback: any
    • Optional loginBoxMessage: string

    Returns void

whoami

  • whoami(callback: function): void
  • Parameters

    • callback: function

    Returns void

Generated using TypeDoc