Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

chevinbrown/duo_client_elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DuoClient

The elixir connector for the Duo Authentication API. Currently, this package should be considered unstable and incomplete.

Installation

Add duo_client as dependency in mix.exs

def deps do
  [
    {:duo_client, "~> 0.1.0"}
  ]
end

Configuration

config :duo_client, :settings,
  ikey: "",
  skey: "",
  host: "api-secret.duosecurity.com"

Usage

Methods supported:

  • ping
  • check
  • preauth
  • auth

Authentication factors supported:

  • :push

Each method requires a struct to format parameters. For example, DuoClient.preauth requires a %Preauth{} struct as the first argument.

Where applicable, default key-values will be picked.

Preauth Example

DuoClient.preauth(%Preauth{id: "username"})```

Example success response:
```elixir
{:ok, :auth,
 %{
   "devices" => [
     %{
       "capabilities" => ["auto", "push", "sms", "phone", "mobile_otp"],
       "device" => "DPZXXXXX",
       "display_name" => "iOS (XXX-XXX-XXXX)",
       "name" => "",
       "number" => "XXX-XXX-XXXX",
       "type" => "phone"
     }
   ],
   "result" => "auth",
   "status_msg" => "Account is active"
 }}

Auth Example

DuoClient.auth(%Auth{id: "username", factor: :push}, %FactorPush{device: "auto"})

Example success response:

{:ok,
 %{
   "result" => "allow",
   "status" => "allow",
   "status_msg" => "Success. Logging you in..."
 }}

License

The gem is available as open source under the terms of the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages