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
- #init_authenticator(request, env, username) ⇒ 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
42 43 44 45 46 47 48 |
# File 'lib/omniauth/strategies/kerberos.rb', line 42 def callback_phase if authenticate(username, password) super else fail!(:invalid_credentials) end end |
#init_authenticator(request, env, username) ⇒ Object
36 37 38 39 40 |
# File 'lib/omniauth/strategies/kerberos.rb', line 36 def init_authenticator(request, env, username) @request = request @env = env @username = username end |
#other_phase ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/omniauth/strategies/kerberos.rb', line 58 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
50 51 52 53 54 55 56 |
# File 'lib/omniauth/strategies/kerberos.rb', line 50 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 @username || request&.params[username_id]&.to_s end |
#username_id ⇒ Object
20 21 22 |
# File 'lib/omniauth/strategies/kerberos.rb', line 20 def username_id [:fields][0]&.to_s || 'username' end |