This API documentation is for Ballerina 1.2.0. View API documentation for the latest release.

Object - auth : InboundBasicAuthProvider

Represents the configuration file based inbound Basic Auth provider, which is an implementation of the auth:InboundAuthProvider interface.

  auth:InboundBasicAuthProvider inboundBasicAuthProvider = new;

A user is denoted by a section in the Ballerina configuration file. The password and the scopes assigned to the user are denoted as keys under the relevant user section as shown below.

 [b7a.users.<username>]
 password="<password>"
 scopes="<comma_separated_scopes>"

Constructor

__init

(BasicAuthConfig? basicAuthConfig)

Methods

Attempts to authenticate the base64-encoded username:password credentials.

Fields

authenticate

(string credential)

returns boolean | Error

Attempts to authenticate the base64-encoded username:password credentials.

 boolean|auth:Error authenticationResult = inboundBasicAuthProvider.authenticate("<credential>");

Parameters

  • credential string
  • Base64-encoded username:password value

  • Return Type

    (boolean | Error)
  • true if the authentication is successful, false otherwise, or else an auth:Error occurred while authenticating the credentials