Class: RailsIam::Config::Authentication
- Inherits:
-
Object
- Object
- RailsIam::Config::Authentication
- Defined in:
- lib/rails_iam/config/authentication.rb
Instance Attribute Summary collapse
-
#access_token_expires_in ⇒ Object
Returns the value of attribute access_token_expires_in.
-
#access_token_key ⇒ Object
Returns the value of attribute access_token_key.
-
#authentication_error ⇒ Object
Returns the value of attribute authentication_error.
-
#authentication_strategies ⇒ Object
Returns the value of attribute authentication_strategies.
-
#authentication_strategy_error ⇒ Object
Returns the value of attribute authentication_strategy_error.
-
#cookie_options ⇒ Object
Returns the value of attribute cookie_options.
-
#refresh_token_expires_in ⇒ Object
Returns the value of attribute refresh_token_expires_in.
-
#refresh_token_key ⇒ Object
Returns the value of attribute refresh_token_key.
-
#refresh_token_path ⇒ Object
Returns the value of attribute refresh_token_path.
-
#refresh_token_transport ⇒ Object
Returns the value of attribute refresh_token_transport.
-
#refresh_token_transport_error ⇒ Object
Returns the value of attribute refresh_token_transport_error.
-
#session_strategy ⇒ Object
Returns the value of attribute session_strategy.
-
#session_strategy_error ⇒ Object
Returns the value of attribute session_strategy_error.
-
#sign_in_path ⇒ Object
Returns the value of attribute sign_in_path.
-
#sign_out_path ⇒ Object
Returns the value of attribute sign_out_path.
-
#token_error ⇒ Object
Returns the value of attribute token_error.
-
#token_expired_error ⇒ Object
Returns the value of attribute token_expired_error.
Instance Method Summary collapse
-
#initialize ⇒ Authentication
constructor
A new instance of Authentication.
Constructor Details
#initialize ⇒ Authentication
Returns a new instance of Authentication.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rails_iam/config/authentication.rb', line 24 def initialize # The key used when storing or reading the access token from cookies or parameters. @access_token_key = "access_token" # The key used when storing or reading the long-lived refresh token. @refresh_token_key = "refresh_token" # Authentication Strategy # Supported: [:cookie], [:bearer], or combined [:cookie, :bearer] @authentication_strategies = %i[cookie] # Session Strategy, allowing user to login from multiple device at the same time # Supported: :single || :multi @session_strategy = :single # Determines how RailsIam receives the refresh token for :bearer strategy # Supported: :header || :request_body @refresh_token_transport = :header # Authentication Endpoints @sign_in_path = "/auth/sign_in" @sign_out_path = "/auth/sign_out" @refresh_token_path = "/auth/refresh" # expiry for access token @access_token_expires_in = 15.minutes @refresh_token_expires_in = 30.days # cookie options @cookie_options = { httponly: true, secure: Rails.env.production?, same_site: :lax }.freeze # Authentication Messages @token_error = "The provided authentication token is invalid or malformed." @token_expired_error = "The authentication token has expired. Please re-authenticate." @authentication_error = "Invalid email or password." @authentication_strategy_error = "Unknown authentication strategy. Please configure it from rails_iam initializer" @session_strategy_error = "Unknown session strategy. Please configure it from rails_iam initializer" @refresh_token_transport_error = "Unknown refresh token transport. Please configure it from rails_iam initializer" end |
Instance Attribute Details
#access_token_expires_in ⇒ Object
Returns the value of attribute access_token_expires_in.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def access_token_expires_in @access_token_expires_in end |
#access_token_key ⇒ Object
Returns the value of attribute access_token_key.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def access_token_key @access_token_key end |
#authentication_error ⇒ Object
Returns the value of attribute authentication_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def authentication_error @authentication_error end |
#authentication_strategies ⇒ Object
Returns the value of attribute authentication_strategies.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def authentication_strategies @authentication_strategies end |
#authentication_strategy_error ⇒ Object
Returns the value of attribute authentication_strategy_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def authentication_strategy_error @authentication_strategy_error end |
#cookie_options ⇒ Object
Returns the value of attribute cookie_options.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def @cookie_options end |
#refresh_token_expires_in ⇒ Object
Returns the value of attribute refresh_token_expires_in.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def refresh_token_expires_in @refresh_token_expires_in end |
#refresh_token_key ⇒ Object
Returns the value of attribute refresh_token_key.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def refresh_token_key @refresh_token_key end |
#refresh_token_path ⇒ Object
Returns the value of attribute refresh_token_path.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def refresh_token_path @refresh_token_path end |
#refresh_token_transport ⇒ Object
Returns the value of attribute refresh_token_transport.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def refresh_token_transport @refresh_token_transport end |
#refresh_token_transport_error ⇒ Object
Returns the value of attribute refresh_token_transport_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def refresh_token_transport_error @refresh_token_transport_error end |
#session_strategy ⇒ Object
Returns the value of attribute session_strategy.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def session_strategy @session_strategy end |
#session_strategy_error ⇒ Object
Returns the value of attribute session_strategy_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def session_strategy_error @session_strategy_error end |
#sign_in_path ⇒ Object
Returns the value of attribute sign_in_path.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def sign_in_path @sign_in_path end |
#sign_out_path ⇒ Object
Returns the value of attribute sign_out_path.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def sign_out_path @sign_out_path end |
#token_error ⇒ Object
Returns the value of attribute token_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def token_error @token_error end |
#token_expired_error ⇒ Object
Returns the value of attribute token_expired_error.
6 7 8 |
# File 'lib/rails_iam/config/authentication.rb', line 6 def token_expired_error @token_expired_error end |