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

Ueberauth strategy for Active Directory authentication

License

Notifications You must be signed in to change notification settings

torrick/ueberauth_active_directory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UeberauthActiveDirectory

Active Directory Ueberauth strategy using Exldap.

Installation

Add ueberauth_active_directory to your list of dependencies in mix.exs:

def deps do
  [{:ueberauth_active_directory, "~> 0.1"}]
end

Ensure ueberauth_active_directory is started before your application:

def application do
  [applications: [:ueberauth_active_directory]]
end

Run mix deps.get

Usage

Add AD server information to <mix env>.secret.exs

Config Value Usage
server Your Active Directory server address
base Base distingushed name for your domain. e.g. lab.local would be DC=lab,DC=local
port Ldap listening port
ssl Enable SSL
user_dn Bind account username in distinguishedName format
password Bind account password
# config/dev.secret.exs

config :ueberauth, Ueberauth.Strategy.ActiveDirectory.Ldap,
  server: "192.168.250.2",
  base: "DC=lab,DC=local",
  port: 389,
  ssl: false,
  user_dn: "CN=vagrant,CN=Users,DC=lab,DC=local",
  password: "vagrant"

Configure Ueberauth to use the strategy

# config/dev.exs

config :ueberauth, Ueberauth,
  providers: [
    active_directory: { Ueberauth.Strategy.ActiveDirectory, [] },
  ]

Configure authentication routes

scope "/auth", MyApp do
  pipe_through :browser

  get "/:provider", AuthController, :request
  get "/:provider/callback", AuthController, :callback
end

Include Überauth plug in your controller

defmodule MyApp.AuthController do
  use MyApp.Web, :controller
  plug Ueberauth
  ...
end

Tests

Tests require an AD environment to run. The vagrantfile included in the repo will take care of setting up the environment for you.

Prerequisites

Running Tests

  • Clone the repo
  • cd ueberauth_active_directory
  • Run vagrant up
  • Run mix test

About

Ueberauth strategy for Active Directory authentication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published