Class: ListenerFileUserStoreBasicAuthProvider

Isolated

Represents the file user store based listener Basic Auth provider, which is used to authenticate the provided credentials against the provided file user store configurations.

1auth:ListenerFileUserStoreBasicAuthProvider provider = new;

The users are denoted by a section in the Config.toml file. The username, password, and the scopes of a particular user are denoted as keys under the users section as shown below. For multiple users, the complete section has to be duplicated.

1[[ballerina.auth.users]]
2username = "alice"
3password = "password1"
4scopes = ["scope1", "scope2"]

Constructor

Provides authentication based on the provided configurations.

init (FileUserStoreConfig fileUserStoreConfig)

Methods

authenticate

Authenticate the Base64-encoded username:password credentials.

authenticate

function authenticate(string credential) returns UserDetails | Error
Isolated Function

Authenticate the Base64-encoded username:password credentials.

1auth:UserDetails result = check provider.authenticate("<credential>");

Parameters

  • credential string
  • The Base64-encoded username:password value

Return Type

(UserDetails | Error)

auth:UserDetails if the authentication is successful or else an auth:Error if an error occurred