Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MongoAuth

An extension of AuthProvider which is using as store

Hierarchy

  • any
    • MongoAuth

Index

Properties

Static Readonly DEFAULT_COLLECTION_NAME

DEFAULT_COLLECTION_NAME: string

The default name of the collection to be used

Static Readonly DEFAULT_CREDENTIAL_PASSWORD_FIELD

DEFAULT_CREDENTIAL_PASSWORD_FIELD: string

The default name of the property for the password, like it is transported in credentials by method {@link AuthenticationProvider#authenticate}

Static Readonly DEFAULT_CREDENTIAL_USERNAME_FIELD

DEFAULT_CREDENTIAL_USERNAME_FIELD: string

The default name of the property for the username, like it is transported in credentials by method {@link AuthenticationProvider#authenticate}

Static Readonly DEFAULT_PASSWORD_FIELD

DEFAULT_PASSWORD_FIELD: string

The default name of the property for the password, like it is stored in mongodb

Static Readonly DEFAULT_PERMISSION_FIELD

DEFAULT_PERMISSION_FIELD: string

The default name of the property for the permissions, like it is stored in mongodb. Permissions are expected to be saved as JsonArray

Static Readonly DEFAULT_ROLE_FIELD

DEFAULT_ROLE_FIELD: string

The default name of the property for the roles, like it is stored in mongodb. Roles are expected to be saved as JsonArray

Static Readonly DEFAULT_SALT_FIELD

DEFAULT_SALT_FIELD: string

The default name of the property for the salt field

Static Readonly DEFAULT_USERNAME_FIELD

DEFAULT_USERNAME_FIELD: string

The default name of the property for the username, like it is stored in mongodb

Static Readonly PROPERTY_COLLECTION_NAME

PROPERTY_COLLECTION_NAME: string

The property name to be used to set the name of the collection inside the config

Static Readonly PROPERTY_CREDENTIAL_PASSWORD_FIELD

PROPERTY_CREDENTIAL_PASSWORD_FIELD: string

The property name to be used to set the name of the field, where the password for the credentials is stored inside

Static Readonly PROPERTY_CREDENTIAL_USERNAME_FIELD

PROPERTY_CREDENTIAL_USERNAME_FIELD: string

The property name to be used to set the name of the field, where the username for the credentials is stored inside

Static Readonly PROPERTY_PASSWORD_FIELD

PROPERTY_PASSWORD_FIELD: string

The property name to be used to set the name of the field, where the password is stored inside

Static Readonly PROPERTY_PERMISSION_FIELD

PROPERTY_PERMISSION_FIELD: string

The property name to be used to set the name of the field, where the permissions are stored inside

Static Readonly PROPERTY_ROLE_FIELD

PROPERTY_ROLE_FIELD: string

The property name to be used to set the name of the field, where the roles are stored inside

Static Readonly PROPERTY_SALT_FIELD

PROPERTY_SALT_FIELD: string

The property name to be used to set the name of the field, where the SALT is stored inside

Static Readonly PROPERTY_SALT_STYLE

PROPERTY_SALT_STYLE: string

The property name to be used to set the name of the field, where the salt style is stored inside

Static Readonly PROPERTY_USERNAME_FIELD

PROPERTY_USERNAME_FIELD: string

The property name to be used to set the name of the field, where the username is stored inside

Static Readonly ROLE_PREFIX

ROLE_PREFIX: string

The prefix which is used by the method when checking for role access

Methods

getCollectionName

  • getCollectionName(): string
  • The name of the collection used to store User objects inside. Defaults to DEFAULT_COLLECTION_NAME

    Returns string

getHashStrategy

  • The HashStrategy which is used by the current instance

    Returns HashStrategy

getPasswordCredentialField

  • getPasswordCredentialField(): string
  • Get the name of the field to be used as property for the password of credentials in the method {@link AuthenticationProvider#authenticate}. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD

    Returns string

getPasswordField

  • getPasswordField(): string
  • Get the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD

    Returns string

getPermissionField

  • getPermissionField(): string
  • Get the name of the field to be used for the permissions. Defaults to DEFAULT_PERMISSION_FIELD. Permissions are expected to be saved as JsonArray

    Returns string

getRoleField

  • getRoleField(): string
  • Get the name of the field to be used for the roles. Defaults to DEFAULT_ROLE_FIELD. Roles are expected to be saved as JsonArray

    Returns string

getSaltField

  • getSaltField(): string
  • Get the name of the field to be used for the salt. Only used when {@link HashStrategy#setSaltStyle} is set to

    Returns string

getUsernameCredentialField

  • getUsernameCredentialField(): string
  • Get the name of the field to be used as property for the username in the method {@link AuthenticationProvider#authenticate}. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD

    Returns string

getUsernameField

  • getUsernameField(): string
  • Get the name of the field to be used for the username. Defaults to DEFAULT_USERNAME_FIELD

    Returns string

insertUser

  • insertUser(username: string, password: string, roles: string, permissions: string): PromiseLike<string>
  • insertUser(username: string, password: string, roles: string, permissions: string, resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>): void
  • Parameters

    • username: string
    • password: string
    • roles: string
    • permissions: string

    Returns PromiseLike<string>

  • Parameters

    • username: string
    • password: string
    • roles: string
    • permissions: string
    • resultHandler: ((res: AsyncResult<string>) => void) | Handler<AsyncResult<string>>

    Returns void

setCollectionName

  • setCollectionName(collectionName: string): MongoAuth
  • Set the name of the collection to be used. Defaults to DEFAULT_COLLECTION_NAME

    Parameters

    • collectionName: string

    Returns MongoAuth

setHashAlgorithm

  • The Hash Algorithm which is used by the current instance

    Parameters

    Returns MongoAuth

setHashStrategy

  • The HashStrategy which is used by the current instance

    Parameters

    Returns MongoAuth

setPasswordCredentialField

  • setPasswordCredentialField(fieldName: string): MongoAuth
  • Set the name of the field to be used as property for the password of credentials in the method {@link AuthenticationProvider#authenticate}. Defaults to DEFAULT_CREDENTIAL_PASSWORD_FIELD

    Parameters

    • fieldName: string

    Returns MongoAuth

setPasswordField

  • setPasswordField(fieldName: string): MongoAuth
  • Set the name of the field to be used for the password Defaults to DEFAULT_PASSWORD_FIELD

    Parameters

    • fieldName: string

    Returns MongoAuth

setPermissionField

  • setPermissionField(fieldName: string): MongoAuth
  • Set the name of the field to be used for the permissions. Defaults to DEFAULT_PERMISSION_FIELD. Permissions are expected to be saved as JsonArray

    Parameters

    • fieldName: string

    Returns MongoAuth

setRoleField

  • Set the name of the field to be used for the roles. Defaults to DEFAULT_ROLE_FIELD. Roles are expected to be saved as JsonArray

    Parameters

    • fieldName: string

    Returns MongoAuth

setSaltField

  • Set the name of the field to be used for the salt. Only used when {@link HashStrategy#setSaltStyle} is set to

    Parameters

    • fieldName: string

    Returns MongoAuth

setUsernameCredentialField

  • setUsernameCredentialField(fieldName: string): MongoAuth
  • Set the name of the field to be used as property for the username in the method {@link AuthenticationProvider#authenticate}. Defaults to DEFAULT_CREDENTIAL_USERNAME_FIELD

    Parameters

    • fieldName: string

    Returns MongoAuth

setUsernameField

  • setUsernameField(fieldName: string): MongoAuth
  • Set the name of the field to be used for the username. Defaults to DEFAULT_USERNAME_FIELD

    Parameters

    • fieldName: string

    Returns MongoAuth

Static create

  • create(mongoClient: MongoClient, config: {}): MongoAuth
  • Creates an instance of MongoAuth by using the given and configuration object. An example for a configuration object:

    JsonObject js = new JsonObject();
    js.put(MongoAuth.PROPERTY_COLLECTION_NAME, createCollectionName(MongoAuth.DEFAULT_COLLECTION_NAME));
    

    Parameters

    • mongoClient: MongoClient
    • config: {}
      • [key: string]: any

    Returns MongoAuth

Generated using TypeDoc