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
Defined Under Namespace
Classes: 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(, ) @cookies = @authorization_header = 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 @authorization_header end |
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
10 11 12 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 10 def @cookies end |
Instance Method Details
#authenticate! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/services/stormpath/rails/controller_authentication.rb', line 17 def authenticate! if FromCookies.new().authenticate! elsif Stormpath::Authentication::HttpBearerAuthentication.new( Stormpath::Rails::Client.application, , local: validation_strategy ).authenticate!.account elsif Stormpath::Authentication::HttpBasicAuthentication.new( Stormpath::Rails::Client.application, ).authenticate!.account else raise UnauthenticatedRequest end end |