This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ruby_version=${1:-"2.5.3"} | |
gem_version=${2:-"2.7.7"} | |
ruby_archive="$ruby_version.tar.gz" | |
ruby_install_path="/home/runner/.rbenv/versions/$ruby_version" | |
if [ ! -e /home/runner/.rbenv ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def logout | |
reset_session | |
redirect_to "https://adfs.example.com/adfs/ls/?wa=wsignout1.0&wreply=https://#{request.host}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
auth = request.env["omniauth.auth"] | |
auth.uid # Gets the UID value of the user that has just signed in | |
# Create a session, redirect etc | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match '/auth/:provider/callback' => 'sessions#create', via: [:get, :post] | |
match '/auth/failure' => 'sessions#failure', via: [:get] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :wsfed, | |
:issuer_name => "http://adfs.example.com/adfs/services/trust", | |
:issuer => "https://adfs.example.com/adfs/ls/", | |
:realm => "https://myapp.com", | |
:reply => "https://myapp.com/auth/wsfed/callback", | |
:saml_version => "1", | |
:id_claim => "upn", | |
:idp_cert_fingerprint => "2ds.........." | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'omniauth' | |
gem 'omniauth-wsfed', '0.3.2.pre.beta' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<EntityDescriptor ID="_271f377f-78d8-4133-8c46-a73c4936bb1f" entityID="https://example.com" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> | |
<RoleDescriptor xsi:type="fed:ApplicationServiceType" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<fed:TargetScopes> | |
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> | |
<wsa:Address>https://example.com/</wsa:Address> | |
</wsa:EndpointReference> | |
</fed:TargetScopes> | |
<fed:PassiveRequestorEndpoint> | |
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WardenHelper | |
extend ActiveSupport::Concern | |
included do | |
helper_method :warden, :current_user | |
prepend_before_filter :authenticate! | |
end | |
def current_user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require Rails.root.join('lib/strategies/azure_ad_json_web_token_strategy') | |
Warden::Strategies.add(:azure_ad_json_web_token, AzureAdJsonWebTokenStrategy) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.middleware.insert_after ActionDispatch::ParamsParser, Warden::Manager do |manager| | |
manager.default_strategies :azure_ad_json_web_token | |
manager.failure_app = UnauthorizedController | |
end |
NewerOlder