abstract class Dwarf::Strategies::Base
- Dwarf::Strategies::Base
- Reference
- Object
Included Modules
Defined in:
dwarf/services/amber.crdwarf/services/common.cr
dwarf/services/kemal.cr
dwarf/strategies/base.cr
Constructors
Instance Method Summary
- #authenticate!(scope : String | Nil = nil, strategy : String | Nil = nil)
-
#clear!
Marks this strategy as not performed.
- #context : HTTP::Server::Context
- #context=(context : HTTP::Server::Context)
- #context? : HTTP::Server::Context | Nil
- #custom!(body : String, status_code : Int32 = 200, headers = HTTP::Headers.new)
- #custom_response : Response
- #custom_response=(custom_response : Response)
- #custom_response? : Response | Nil
-
#fail(message : Nil | String = "Failed to Login", halted : Bool = false)
Causes the strategy to fail, but not halt.
-
#fail!(message = "Failed to Login")
This causes the strategy to fail.
-
#halt!
Cause the processing of the strategies to stop and cascade no further
-
#halted?
Checks to see if a strategy was halted
- #headers(header = HTTP::Headers.new)
- #message : String | Nil
- #message=(message : String | Nil)
- #params
-
#pass
A simple method to return from authenticate! if you want to ignore this strategy
-
#performed? : Bool
Returns if this strategy was already performed.
-
#redirect!(url, message : String | Nil = nil, content_type = "text/plain", permanent = true)
Causes the authentication to redirect.
- #request(*args, **options)
- #request(*args, **options, &)
- #result : Result
- #result=(result : Result)
-
#success!(user : JSON::Any, message : String | Nil = nil)
Whenever you want to provide a user object as "authenticated" use the
#success!
method. -
#successful?
Returns true only if the result is a success and a user was assigned.
- #user : JSON::Any
- #user=(user : JSON::Any)
- #user? : JSON::Any | Nil
- #valid? : String | Nil | Bool
Instance methods inherited from module Dwarf::Mixins
files
files,
params : HTTP::Params
params,
request
request
Constructor Detail
Instance Method Detail
Causes the strategy to fail, but not halt. The strategies will cascade after this failure and warden will check the next strategy. The last strategy to fail will have it's message displayed.
This causes the strategy to fail. It does not raise Dwarf::Error to drop the request out to the failure application You must throw an :warden symbol somewhere in the application to enforce this Halts the strategies so that this is the last strategy checked
Causes the authentication to redirect. An Dwarf::Error must be thrown to actually execute this redirect
Whenever you want to provide a user object as "authenticated" use the #success!
method.
This will halt the strategy, and set the user in the appropriate scope.
It is the "login" method