authable v0.5.1 Authable.Authentications.Basic

Basic authentication helper module

Summary

Functions

Authenticates resource-owner using Basic Authentication header value

Functions

authenticate(auth_credentials)

Authenticates resource-owner using Basic Authentication header value.

It handles the decoding the ‘Authorization: Basic {auth_credentials}’ and matches resource owner with given email and password. If any resource owner matched given credentials, it returns resource owner struct, otherwise nil.

Examples

# Suppose we have a resource owner with
# email: foo@example.com and password: 12345678.
# Base 64 encoding of email:password combination will be
# 'Zm9vQGV4YW1wbGUuY29tOjEyMzQ1Njc4'. If we pass the encoded value
# to the function, it will return resource-owner
Authable.Authentications.Basic.authenticate(
  "Zm9vQGV4YW1wbGUuY29tOjEyMzQ1Njc4")