Skip to content

Commit

Permalink
Azure AD -> Azure rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mbkloster committed Apr 2, 2020
1 parent afd3f38 commit d7bc5df
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For example, in Rails you would add this in `config/initializers/omniauth.rb`:

```ruby
Rails.application.config.middleware.use OmniAuth::Builder do
provider :azure_activedirectory, ENV['AAD_CLIENT_ID'], ENV['AAD_TENANT']
provider :azure, ENV['AAD_CLIENT_ID'], ENV['AAD_TENANT']
# other providers here
end
```
Expand All @@ -51,11 +51,11 @@ If you are using Sinatra or something else that requires you to configure Rack y

```ruby
use OmniAuth::Builder do
provider :azure_activedirectory, ENV['AAD_CLIENT_ID'], ENV['AAD_TENANT']
provider :azure, ENV['AAD_CLIENT_ID'], ENV['AAD_TENANT']
end
```

When you want to authenticate the user, simply redirect them to `/auth/azureactivedirectory`. From there, OmniAuth will takeover. Once the user authenticates (or fails to authenticate), they will be redirected to `/auth/azureactivedirectory/callback` or `/auth/azureactivedirectory/failure`. The authentication result is available in `request.env['omniauth.auth']`.
When you want to authenticate the user, simply redirect them to `/auth/azure`. From there, OmniAuth will takeover. Once the user authenticates (or fails to authenticate), they will be redirected to `/auth/azure/callback` or `/auth/azure/failure`. The authentication result is available in `request.env['omniauth.auth']`.

If you are supporting multiple OmniAuth providers, you will likely have something like this in your code:

Expand All @@ -77,7 +77,7 @@ OmniAuth AzureAD tries to be consistent with the auth hash schema recommended by
Here's an example of an authentication hash available in the callback. You can access this hash as `request.env['omniauth.auth']`.

```
:provider => "azureactivedirectory",
:provider => "azure",
:uid => "123456abcdef",
:info => {
:name => "John Smith",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token

def new
redirect_to '/auth/azureactivedirectory'
redirect_to '/auth/azure'
end

def create
Expand Down
2 changes: 1 addition & 1 deletion examples/rails-todo-list-app/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def self.from_omniauth(auth_hash)
if auth_hash[:credentials]['code']
user.redeem_code(
auth_hash[:credentials]['code'],
'https://localhost:9292/auth/azureactivedirectory/callback')
'https://localhost:9292/auth/azure/callback')
end
user.save!
user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :azure_activedirectory, ENV['CLIENT_ID'], ENV['TENANT']
provider :azure, ENV['CLIENT_ID'], ENV['TENANT']
end
2 changes: 1 addition & 1 deletion examples/rails-todo-list-app/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
resources :tasks, only: [:index, :update, :create, :destroy, :post]

# This is where we send people to authenticate with OmniAuth.
get '/auth/azureactivedirectory', as: :sign_in
get '/auth/azure', as: :sign_in

# This is where we are redirected if OmniAuth successfully authenicates
# the user.
Expand Down
2 changes: 1 addition & 1 deletion examples/sinatra-multiple-providers-app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<<-HTML
<h3>Hello there!</h3>
<a href='/auth/amazon'>Sign in with Amazon</a>
<a href='/auth/azureactivedirectory'>Sign in with AzureAD</a>
<a href='/auth/azure'>Sign in with AzureAD</a>
<a href='/auth/github'>Sign in with Github</a>
<a href='/auth/google_oauth2'>Sign in with Google</a>
HTML
Expand Down
2 changes: 1 addition & 1 deletion examples/sinatra-multiple-providers-app/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use Rack::Session::Cookie, secret: 'top secret'

use OmniAuth::Builder do
provider :amazon, ENV['AMAZON_KEY'], ENV['AMAZON_SECRET']
provider :azure_activedirectory, ENV['AAD_KEY'], ENV['AAD_TENANT']
provider :azure, ENV['AAD_KEY'], ENV['AAD_TENANT']
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
end
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth-azure-activedirectory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
# THE SOFTWARE.
#-------------------------------------------------------------------------------

require 'omniauth/azure_activedirectory'
require 'omniauth/azure'
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
# THE SOFTWARE.
#-------------------------------------------------------------------------------

require 'omniauth/azure_activedirectory/version'
require 'omniauth/strategies/azure_activedirectory'
require 'omniauth/azure/version'
require 'omniauth/strategies/azure'
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

module OmniAuth
# The release version.
module AzureActiveDirectory
module Azure
VERSION = '1.0.0'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
module OmniAuth
module Strategies
# A strategy for authentication against Azure Active Directory.
class AzureActiveDirectory
include OmniAuth::AzureActiveDirectory
class Azure
include OmniAuth::Azure
include OmniAuth::Strategy

class OAuthError < StandardError; end
Expand All @@ -42,7 +42,7 @@ class OAuthError < StandardError; end
# require 'omniauth-azure-activedirectory'
#
# use OmniAuth::Builder do
# provider :azure_activedirectory, ENV['AAD_KEY'], ENV['AAD_TENANT']
# provider :azure, ENV['AAD_KEY'], ENV['AAD_TENANT']
# end
#
args [:client_id, :tenant]
Expand Down Expand Up @@ -332,4 +332,4 @@ def verify_options
end
end

OmniAuth.config.add_camelization 'azure_activedirectory', 'AzureActiveDirectory'
OmniAuth.config.add_camelization 'azure', 'Azure'
4 changes: 2 additions & 2 deletions omniauth-azure-activedirectory.gemspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'omniauth/azure_activedirectory/version'
require 'omniauth/azure/version'

Gem::Specification.new do |s|
s.name = 'omniauth-azure-activedirectory'
s.version = OmniAuth::AzureActiveDirectory::VERSION
s.version = OmniAuth::Azure::VERSION
s.author = 'Microsoft Corporation'
s.email = '[email protected]'
s.summary = 'Azure Active Directory strategy for OmniAuth'
Expand Down
2 changes: 1 addition & 1 deletion spec/omniauth/strategies/azure_activedirectory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# This was fairly awkward to test. I've stubbed every endpoint and am simulating
# the state of the request. Especially large strings are stored in fixtures.
describe OmniAuth::Strategies::AzureActiveDirectory do
describe OmniAuth::Strategies::Azure do
let(:app) { -> _ { [200, {}, ['Hello world.']] } }
let(:x5c) { File.read(File.expand_path('../../../fixtures/x5c.txt', __FILE__)) }

Expand Down

0 comments on commit d7bc5df

Please sign in to comment.