Extension
A Provider Authentication Policy request, sent from a relying party to a provider
Instantiate a Request object from the arguments in a checkid_* OpenID message return nil if the extension was not requested.
# File lib/openid/extensions/pape.rb, line 49 def self.from_openid_request(oid_req) pape_req = new args = oid_req.message.get_args(NS_URI) if args == {} return nil end pape_req.parse_extension_args(args) return pape_req end
Add an acceptable authentication policy URI to this request This method is intended to be used by the relying party to add acceptable authentication types to the request.
# File lib/openid/extensions/pape.rb, line 32 def add_policy_uri(policy_uri) unless @preferred_auth_policies.member? policy_uri @preferred_auth_policies << policy_uri end end
# File lib/openid/extensions/pape.rb, line 38 def get_extension_args ns_args = { 'preferred_auth_policies' => @preferred_auth_policies.join(' ') } ns_args['max_auth_age'] = @max_auth_age.to_s if @max_auth_age return ns_args end
Set the state of this request to be that expressed in these PAPE arguments
# File lib/openid/extensions/pape.rb, line 61 def parse_extension_args(args) @preferred_auth_policies = [] policies_str = args['preferred_auth_policies'] if policies_str policies_str.split(' ').each{|uri| add_policy_uri(uri) } end max_auth_age_str = args['max_auth_age'] if max_auth_age_str @max_auth_age = max_auth_age_str.to_i else @max_auth_age = nil end end
Given a list of authentication policy URIs that a provider supports, this method returns the subset of those types that are preferred by the relying party.
# File lib/openid/extensions/pape.rb, line 81 def preferred_types(supported_types) @preferred_auth_policies.select{|uri| supported_types.member? uri} end
Generated with the Darkfish Rdoc Generator 2.