ballerina.auth.basic package

public struct AuthenticationInfo

Represents an authentication decision about a user

Field Name Data Type Description Default Value
username string user name
isAuthenticated boolean authentication decision, true if authenticated, else false

public struct BasicAuthenticator

Represents a Basic Authenticator

Field Name Data Type Description Default Value
credentialsStore CredentialsStore CredentialsStore object; ex.: in basic authenticator, the user store
authCache Cache Authentication cache object
  • < BasicAuthenticator > authenticate ( string username , string password ) ( boolean )

    Performs basic authentication with the given username and password

    Parameter Name Data Type Description
    username string user name
    password string password

    Return Variable Data Type Description
    boolean boolean: true if authentication is successful, else false

public struct HttpBasicAuthnHandler

Basic authenticator instance

  • < HttpBasicAuthnHandler > canHandle ( InRequest req ) ( boolean )

    Checks if the provided request can be authenticated with basic auth

    Parameter Name Data Type Description
    req InRequest InRequest object

    Return Variable Data Type Description
    boolean boolean: true if its possible authenticate with basic auth, else false
  • < HttpBasicAuthnHandler > handle ( InRequest req ) ( boolean )

    Intercepts a request for authentication

    Parameter Name Data Type Description
    req InRequest InRequest object

    Return Variable Data Type Description
    boolean boolean: true if authentication is a success, else false

public function createAuthenticator ( CredentialsStore credentialsStore , Cache cache ) ( BasicAuthenticator )

Creates a Basic Authenticator

Parameter Name Data Type Description
credentialsStore CredentialsStore implementation of the credentials store - ldap, jdbc, file based userstore, etc.
cache Cache cache instance

Return Variable Data Type Description
BasicAuthenticator BasicAuthenticator instance