Class: OmniAuth::Strategies::GitLab
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::GitLab
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/gitlab.rb
Instance Method Summary collapse
Instance Method Details
#callback_phase ⇒ Object
26 27 28 29 |
# File 'lib/omniauth/strategies/gitlab.rb', line 26 def callback_phase return fail!(:invalid_credentials) unless identity super end |
#identity ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/omniauth/strategies/gitlab.rb', line 48 def identity @identity ||= begin conn = Faraday.new(:url => [:site]) resp = conn.post do |req| req.url '/api/v3/session' req.headers['Content-Type'] = 'application/json' req.params = { :email => request['email'], :password => request['password'] } end resp.success? ? MultiJson.load(resp.body) : nil end end |
#request_phase ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/omniauth/strategies/gitlab.rb', line 13 def request_phase if [:on_login] [:on_login].call(self.env) else form = OmniAuth::Form.new(:title => ([:title] || "Gitlab Verification"), :url => callback_path) form.text_field 'Email', 'email' form.password_field 'Password', 'password' form. "Sign In" form.to_response end end |