Skip to content

Commit

Permalink
Merge d876822 into a0eedd6
Browse files Browse the repository at this point in the history
  • Loading branch information
dnic committed Sep 25, 2019
2 parents a0eedd6 + d876822 commit dbf7751
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion lib/omniauth/strategies/saml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def self.inherited(subclass)
{ :name => 'email', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Email address' },
{ :name => 'name', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Full name' },
{ :name => 'first_name', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Given name' },
{ :name => 'last_name', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Family name' }
{ :name => 'last_name', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Family name' },
{ :name => 'token', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Access Token' },
{ :name => 'expires', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Expiration Bool' },
{ :name => 'expires_at', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Expiration Time' }
]
option :attribute_service_name, 'Required attributes'
option :attribute_statements, {
Expand All @@ -27,6 +30,11 @@ def self.inherited(subclass)
first_name: ["first_name", "firstname", "firstName"],
last_name: ["last_name", "lastname", "lastName"]
}
option :credentials_statements, {
token: ["token"],
expires: ["expires"],
expires_at: ["expires_at"]
}
option :slo_default_relay_state
option :uid_attribute
option :idp_slo_session_destroy, proc { |_env, session| session.clear }
Expand Down Expand Up @@ -108,6 +116,21 @@ def other_phase
Hash[found_attributes]
end

credentials do
# found_credentials = options.credentials_statements.map do |key, values|
# credential = find_credential_by(values)
# [key, credential]
# end
#
# Hash[found_credentials]

token = @session_index
expires = true
expires_at = @response_object.session_expires_at

Hash[['token', token], ['expires', expires], ['expires_at', expires_at]]
end

extra { { :raw_info => @attributes, :session_index => @session_index, :response_object => @response_object } }

def find_attribute_by(keys)
Expand All @@ -118,6 +141,14 @@ def find_attribute_by(keys)
nil
end

# def find_credential_by(keys)
# keys.each do |key|
# return @response_object.dig(key) if @response_object.dig(key)
# end
#
# nil
# end

private

def request_path_pattern
Expand Down

0 comments on commit dbf7751

Please sign in to comment.