Code Monkey home page Code Monkey logo

adauth's Introduction

Adauth

RDoc | www | Gempage | Status | Code Climate | Dependency Status

Easy to use Active Directory Authentication for Rails.

Install

Add the Adauth gem to your Gemfile:

gem 'adauth'

and run a bundle install

Usage

In Rails

First off create a new config file by running the config generator

rails g adauth:config

Fill out the config values in config/initializers/adauth.rb

Joining a model to Adauth

If you want to link your user model to Adauth you can use this simple code:

class User < ActiveRecord::Base
	include Adauth::Rails::ModelBridge
	
	AdauthMappings = {
		:login => :login
		:group_strings => :cn_groups
	}
	
	AdauthSearchField = [:login, :login]
end

This gives you a bridge between Adauth and your model. When you call User.create_from_adauth(adauth_model) it does:

u = User.new
u.login = adauth_model.login
u.group_strings = adauth_model.cn_groups
u.save

This can be used for any model and anything that you pull over through adauth.

SessionsController

You can use a premade sessions controller by running

rails g adauth:sessions

Which adds a couple of routes, a sessions controller and a login form. To login go to /sessions/new and fill out the form, you will then POST to /adauth and if succesful you will be sent back to root_path

In Scripts

To use Adauth in a script or other program just call Adauth.configure somewhere at the begining of the script, once configured Adauth can be used anywhere in your program the same as rails.

Configuring

Adauth has a few configuration options which are described in detail on the wiki.

Logs

Adauth logs to weekly logs in logs/adauth.log(.DATE)

You can interact with the logger through Adauth.logger and set a new one using Adauth.logger=

Developing

Before you can run the tests you will need to write a yml file with your domain settings in and place it at spec/test_data.yml, there is an example of this file in the spec folder.

When you fork Adauth please:

  1. Create your feature branch (git checkout -b my-new-feature)
  2. Commit your changes (git commit -am 'Add some feature')
  3. Push to the branch (git push origin my-new-feature)
  4. Create new Pull Request

adauth's People

Contributors

arcath avatar henningms avatar jerry avatar mjblack avatar tedpennings avatar coreypurcell avatar plukevdh avatar tcfunk avatar vollnhals avatar

Watchers

James Cloos avatar Don Reilly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.