Class: Stormpath::Rails::ControllerAuthentication
- Inherits:
-
Object
- Object
- Stormpath::Rails::ControllerAuthentication
- Defined in:
- app/services/stormpath/rails/controller_authentication.rb,
app/services/stormpath/rails/controller_authentication/from_cookies.rb,
app/services/stormpath/rails/controller_authentication/from_basic_auth.rb,
app/services/stormpath/rails/controller_authentication/from_bearer_auth.rb
Defined Under Namespace
Classes: FromBasicAuth, FromBearerAuth, FromCookies
Constant Summary collapse
- UnauthenticatedRequest =
Class.new(StandardError)
- BEARER_PATTERN =
/^Bearer /- BASIC_PATTERN =
/^Basic /- ACCESS_TOKEN_COOKIE_NAME =
Stormpath::Rails.config.web..name
- REFRESH_TOKEN_COOKIE_NAME =
Stormpath::Rails.config.web..name
Instance Attribute Summary collapse
-
#authorization_header ⇒ Object
readonly
Returns the value of attribute authorization_header.
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
Instance Method Summary collapse
- #authenticate! ⇒ Object
-
#initialize(cookies, authorization_header) ⇒ ControllerAuthentication
constructor
A new instance of ControllerAuthentication.
Constructor Details
#initialize(cookies, authorization_header) ⇒ ControllerAuthentication
Returns a new instance of ControllerAuthentication.
12 13 14 15 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 12 def initialize(, ) = = end |
Instance Attribute Details
#authorization_header ⇒ Object (readonly)
Returns the value of attribute authorization_header.
10 11 12 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 10 def end |
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
10 11 12 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 10 def end |
Instance Method Details
#authenticate! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 17 def authenticate! if FromCookies.new().authenticate! elsif FromBearerAuth.new().authenticate! elsif FromBasicAuth.new().authenticate! else raise UnauthenticatedRequest end end |