Class: OpenShift::RemoteUserAuthService
- Inherits:
-
AuthService
- Object
- AuthService
- OpenShift::RemoteUserAuthService
- Defined in:
- lib/openshift/remote_user_auth_service.rb
Instance Method Summary collapse
-
#authenticate(request, login = nil, password = nil) ⇒ Object
The base_controller will actually pass in a password but it can’t be trusted.
-
#initialize ⇒ RemoteUserAuthService
constructor
A new instance of RemoteUserAuthService.
-
#login(request, params, cookies) ⇒ Object
This is only called by the legacy controller and should be removed as soon as all clients have been ported.
Constructor Details
#initialize ⇒ RemoteUserAuthService
Returns a new instance of RemoteUserAuthService.
8 9 10 11 12 |
# File 'lib/openshift/remote_user_auth_service.rb', line 8 def initialize super @trusted_header = @auth_info[:trusted_header] end |
Instance Method Details
#authenticate(request, login = nil, password = nil) ⇒ Object
The base_controller will actually pass in a password but it can’t be trusted. REMOTE_USER must only be set if the web server has verified the password.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/openshift/remote_user_auth_service.rb', line 17 def authenticate(request, login=nil, password=nil) if request.headers['User-Agent'] == "OpenShift" # password == iv, login == key return validate_broker_key(password, login) else authenticated_user = request.env[@trusted_header] raise OpenShift::AccessDeniedException if authenticated_user.nil? return {:username => authenticated_user, :auth_method => :login} end end |
#login(request, params, cookies) ⇒ Object
This is only called by the legacy controller and should be removed as soon as all clients have been ported.
30 31 32 33 34 35 36 37 38 |
# File 'lib/openshift/remote_user_auth_service.rb', line 30 def login(request, params, ) if params['broker_auth_key'] && params['broker_auth_iv'] return validate_broker_key(params['broker_auth_iv'], params['broker_auth_key']) else username = request.env[@trusted_header] Rails.logger.debug("Found" + username) return authenticate(request, username) end end |