View Source YaBTTWeb.Auth (YaBTT v0.1.5)

Plug for basic authentification.

This Plug allows the client to authenticate with RFC7617.

Default authentication:

  • username: "admin"
  • password: "admin"

example

Example

You can import the module and use it by plug:

import YaBTTWeb.Auth

plug :auth, username: "admin", password: "admin"

Or, use it as a Plug:

plug YaBTTWeb.Auth, username: "admin", password: "admin"

Link to this section Summary

Functions

Authenticates the request when use this module as a module.

Returns the authentication configuration.

Authenticates the request when use this module as a Plug.

Initializes the plug with the given options.

Link to this section Functions

@spec auth(
  Plug.Conn.t(),
  keyword()
) :: Plug.Conn.t()

Authenticates the request when use this module as a module.

example

Example

import YaBTTWeb.Auth

plug :auth
@spec auth_config(keyword()) :: keyword()

Returns the authentication configuration.

priority: plug args > environment > default

@spec call(Plug.Conn.t(), Plug.opts()) :: Plug.Conn.t()

Authenticates the request when use this module as a Plug.

example

Example

plug YaBTTWeb.Auth
@spec init(Plug.opts()) :: Plug.opts()

Initializes the plug with the given options.