Class: SignInService::Client
- Inherits:
-
Object
- Object
- SignInService::Client
- Defined in:
- lib/sign_in_service/client.rb,
lib/sign_in_service/client/config.rb,
lib/sign_in_service/client/session.rb,
lib/sign_in_service/client/authorize.rb
Defined Under Namespace
Modules: Authorize, Config, Session
Constant Summary collapse
- COOKIE_TOKEN_PREFIX =
'vagov'- AUTH_TYPES =
[COOKIE_AUTH = :cookie, API_AUTH = :api].freeze
- AUTH_FLOWS =
[PKCE_FLOW = :pkce, JWT_FLOW = :jwt].freeze
Constants included from Session
Session::LOGOUT_PATH, Session::REFRESH_PATH, Session::REVOKE_ALL_PATH, Session::REVOKE_PATH
Constants included from Authorize
Authorize::AUTHORIZE_PATH, Authorize::TOKEN_PATH
Constants included from Config
Config::DEFAULT_AUTH_FLOW, Config::DEFAULT_AUTH_TYPE, Config::DEFAULT_BASE_URL, Config::DEFAULT_CLIENT_ID
Instance Attribute Summary collapse
-
#auth_flow ⇒ Object
Returns the value of attribute auth_flow.
-
#auth_type ⇒ Object
Returns the value of attribute auth_type.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
Class Method Summary collapse
Instance Method Summary collapse
- #api_auth? ⇒ Boolean
- #client_assertion_type ⇒ Object
- #code_challenge_method ⇒ Object
- #connection ⇒ Object
- #cookie_auth? ⇒ Boolean
- #grant_type ⇒ Object
-
#initialize(**options) ⇒ Client
constructor
A new instance of Client.
Methods included from Session
#logout, #refresh_token, #revoke_all_sessions, #revoke_token
Methods included from Authorize
#authorize, #authorize_uri, #get_token
Methods included from Config
Constructor Details
#initialize(**options) ⇒ Client
Returns a new instance of Client.
32 33 34 35 36 37 |
# File 'lib/sign_in_service/client.rb', line 32 def initialize(**) @base_url = [:base_url] || Config.base_url @client_id = [:client_id] || Config.client_id @auth_type = [:auth_type] || Config.auth_type @auth_flow = [:auth_flow] || Config.auth_flow end |
Instance Attribute Details
#auth_flow ⇒ Object
Returns the value of attribute auth_flow.
30 31 32 |
# File 'lib/sign_in_service/client.rb', line 30 def auth_flow @auth_flow end |
#auth_type ⇒ Object
Returns the value of attribute auth_type.
30 31 32 |
# File 'lib/sign_in_service/client.rb', line 30 def auth_type @auth_type end |
#base_url ⇒ Object
Returns the value of attribute base_url.
30 31 32 |
# File 'lib/sign_in_service/client.rb', line 30 def base_url @base_url end |
#client_id ⇒ Object
Returns the value of attribute client_id.
30 31 32 |
# File 'lib/sign_in_service/client.rb', line 30 def client_id @client_id end |
Class Method Details
.config ⇒ Object
25 26 27 |
# File 'lib/sign_in_service/client.rb', line 25 def config Config end |
.configure {|Config| ... } ⇒ Object
21 22 23 |
# File 'lib/sign_in_service/client.rb', line 21 def configure yield Config end |
Instance Method Details
#api_auth? ⇒ Boolean
60 61 62 |
# File 'lib/sign_in_service/client.rb', line 60 def api_auth? auth_type.to_sym == API_AUTH end |
#client_assertion_type ⇒ Object
47 48 49 |
# File 'lib/sign_in_service/client.rb', line 47 def client_assertion_type 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer' end |
#code_challenge_method ⇒ Object
43 44 45 |
# File 'lib/sign_in_service/client.rb', line 43 def code_challenge_method 'S256' end |
#connection ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/sign_in_service/client.rb', line 51 def connection @connection ||= Faraday.new(base_url) do |conn| conn.request :json conn.response :json, content_type: /\bjson$/ conn.adapter Faraday.default_adapter conn.use SignInService::Response::RaiseError end end |
#cookie_auth? ⇒ Boolean
64 65 66 |
# File 'lib/sign_in_service/client.rb', line 64 def auth_type.to_sym == COOKIE_AUTH end |
#grant_type ⇒ Object
39 40 41 |
# File 'lib/sign_in_service/client.rb', line 39 def grant_type 'authorization_code' end |