-
-
Save tariqhamid/33b758b802b860d39a17b0345b7955bf to your computer and use it in GitHub Desktop.
FederationMetadata Example
This file contains 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"> | |
<wsa:Address>https://example.com/</wsa:Address> | |
</wsa:EndpointReference> | |
</fed:PassiveRequestorEndpoint> | |
</RoleDescriptor> | |
</EntityDescriptor> |
This file contains 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 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 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 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment