Class: OmniAuth::Strategies::Kerberos
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Kerberos
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/kerberos.rb
Instance Method Summary collapse
- #callback_phase ⇒ Object
-
#initialize(app, *args, &block) ⇒ Kerberos
constructor
A new instance of Kerberos.
- #other_phase ⇒ Object
- #password ⇒ Object
- #password_id ⇒ Object
- #request_phase ⇒ Object
- #username ⇒ Object
- #username_id ⇒ Object
Constructor Details
#initialize(app, *args, &block) ⇒ Kerberos
Returns a new instance of Kerberos.
15 16 17 18 |
# File 'lib/omniauth/strategies/kerberos.rb', line 15 def initialize(app, *args, &block) super @krb5 = ::Krb5Auth::Krb5.new end |
Instance Method Details
#callback_phase ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/omniauth/strategies/kerberos.rb', line 36 def callback_phase if authenticate(username, password) super else fail!(:invalid_credentials) end end |
#other_phase ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/omniauth/strategies/kerberos.rb', line 52 def other_phase if on_request_path? request_phase else call_app! end end |
#password ⇒ Object
32 33 34 |
# File 'lib/omniauth/strategies/kerberos.rb', line 32 def password request&.params[password_id] end |
#password_id ⇒ Object
24 25 26 |
# File 'lib/omniauth/strategies/kerberos.rb', line 24 def password_id [:fields][1]&.to_s || 'password' end |
#request_phase ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/omniauth/strategies/kerberos.rb', line 44 def request_phase form = OmniAuth::Form.build(title: .title, url: callback_url) do |f| f.text_field 'Username', username_id f.password_field 'Password', password_id end form.to_response end |
#username ⇒ Object
28 29 30 |
# File 'lib/omniauth/strategies/kerberos.rb', line 28 def username request&.params[username_id] end |
#username_id ⇒ Object
20 21 22 |
# File 'lib/omniauth/strategies/kerberos.rb', line 20 def username_id [:fields][0]&.to_s || 'username' end |