Class: Gitlab::Auth::Saml::OriginValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/auth/saml/origin_validator.rb

Constant Summary collapse

AUTH_REQUEST_SESSION_KEY =
"last_authn_request_id".freeze

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ OriginValidator

Returns a new instance of OriginValidator.


9
10
11
# File 'lib/gitlab/auth/saml/origin_validator.rb', line 9

def initialize(session)
  @session = session || {}
end

Instance Method Details

#gitlab_initiated?(saml_response) ⇒ Boolean

Returns:

  • (Boolean)

17
18
19
20
21
# File 'lib/gitlab/auth/saml/origin_validator.rb', line 17

def gitlab_initiated?(saml_response)
  return false if identity_provider_initiated?(saml_response)

  matches?(saml_response)
end

#store_origin(authn_request) ⇒ Object


13
14
15
# File 'lib/gitlab/auth/saml/origin_validator.rb', line 13

def store_origin(authn_request)
  session[AUTH_REQUEST_SESSION_KEY] = authn_request.uuid
end