Module: Aker::Cas::ConfigurationHelper

Included in:
Authority, ServiceMode
Defined in:
lib/aker/cas/configuration_helper.rb

Overview

A helper for uniform creation of derived attributes for the CAS configuration. It expects to be mixed in to a context that provides a configuration method which returns a Aker::Configuration.

Instance Method Summary collapse

Instance Method Details

#cas_login_urlString

The login URL on the CAS server. This may be set explicitly in the configuration as parameters_for(:cas)[:login_url]. If not set explicitly, it will be derived from the base URL.

Returns:

  • (String)

19
20
21
# File 'lib/aker/cas/configuration_helper.rb', line 19

def 
  configuration.parameters_for(:cas)[:login_url] || URI.join(cas_url, 'login').to_s
end

#cas_logout_urlString

The logout URL on the CAS server. This may be set explicitly in the configuration as parameters_for(:cas)[:logout_url]. If not set explicitly, it will be derived from the base URL.

Returns:

  • (String)

29
30
31
# File 'lib/aker/cas/configuration_helper.rb', line 29

def cas_logout_url
  configuration.parameters_for(:cas)[:logout_url] || URI.join(cas_url, 'logout').to_s
end

#cas_urlString?

The base URL for all not-otherwise-explicitly-specified URLs on the CAS server. It may be set in the CAS parameters as either :base_url (preferred) or :cas_base_url (for backwards compatibility with aker 1.x).

The base URL should end in a / (forward slash). If it does not, a trailing forward slash will be appended.

Returns:

  • (String, nil)

See Also:


45
46
47
48
49
50
# File 'lib/aker/cas/configuration_helper.rb', line 45

def cas_url
  appending_forward_slash do
    configuration.parameters_for(:cas)[:base_url] ||
      configuration.parameters_for(:cas)[:cas_base_url]
  end
end

#proxy_callback_urlString?

The URL that CAS will provide the PGT and PGTIOU to, per section 2.5.4 of the spec. Some CAS servers require that this be an SSL-protected resource. It is set in the CAS parameters as :proxy_callback_url.

Returns:

  • (String, nil)

59
60
61
# File 'lib/aker/cas/configuration_helper.rb', line 59

def proxy_callback_url
  configuration.parameters_for(:cas)[:proxy_callback_url]
end

#proxy_retrieval_urlString?

The URL that the CAS client can retrieve the PGT from once it has been deposited at the #proxy_callback_url by the CAS server. It is set in the CAS parameters as :proxy_retrieval_url.

(Note that this is not part of the CAS protocol — it is client-specific.)

Returns:

  • (String, nil)

73
74
75
# File 'lib/aker/cas/configuration_helper.rb', line 73

def proxy_retrieval_url
  configuration.parameters_for(:cas)[:proxy_retrieval_url]
end