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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb')
-rw-r--r--vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb b/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb
new file mode 100644
index 00000000000..3db9e5fe435
--- /dev/null
+++ b/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb
@@ -0,0 +1,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 \ No newline at end of file