Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sinatra.rb « examples « omniauth-azure-oauth2 « gems « vendor - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3db9e5fe435e1aaecaf9e4364fab1f1136a244bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$:.push File.dirname(__FILE__) + '/../lib'

require 'omniauth-azure-oauth2'
require 'sinatra'

class MyAzureProvider
  def self.client_id
    ENV['AZURE_CLIENT_ID']
  end

  def self.client_secret
    ENV['AZURE_CLIENT_SECRET']
  end

  def self.tenant_id
    ENV['AZURE_TENANT_ID']
  end

end

use Rack::Session::Cookie
use OmniAuth::Strategies::Azure, MyAzureProvider

get '/' do
  "<a href='/auth/azure_oauth2'>Log in with Azure</a>"
end

get '/auth/azure_oauth2/callback' do
  content_type 'text/plain'
  request.env['omniauth.auth'].inspect
end