Sha256: 979746c82fca701b5bf32398d39cc6a11250cab68931edf37b68f800d0ef5e6a
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
module OmniAuth module Strategies class Shibboleth include OmniAuth::Strategy option :uid_field, :eppn option :fields, [:name, :email] option :extra_fields, [] option :debug, false def request_phase [ 302, { 'Location' => script_name + callback_path + query_string, 'Content-Type' => 'text/plain' }, ["You are being redirected to Shibboleth SP/IdP for sign-in."] ] end def callback_phase if options[:debug] # dump attributes return [ 200, { 'Content-Type' => 'text/plain' }, [request.env.sort.map {|i| "#{i[0]}: #{i[1]}" }.join("\n")] ] end return fail!(:no_shibboleth_session) unless (request.env['Shib-Session-ID'] || request.env['Shib-Application-ID']) super end uid do request.env[options.uid_field.to_s] end info do options.fields.inject({}) do |hash, field| case field when :name hash[field] = request.env['displayName'] when :email hash[field] = request.env['mail'] else hash[field] = request.env[field.to_s] end hash end end extra do options.extra_fields.inject({:raw_info => {}}) do |hash, field| hash[:raw_info][field] = request.env[field.to_s] hash end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-shibboleth-1.0.6 | lib/omniauth/strategies/shibboleth.rb |