debian-mirror-gitlab/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb
2022-08-27 11:52:29 +05:30

31 lines
No EOL
549 B
Ruby

$:.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