View Source AshAuthentication.Strategy.Custom behaviour (ash_authentication v3.9.5)
Define your own custom authentication strategy.
See the Custom Strategies guide for more information.
Link to this section Summary
Callbacks
If your strategy needs to modify either the entity or the parent resource then you can implement this callback.
If your strategy needs to verify either the entity or the parent resource then you can implement this callback.
Link to this section Types
@type entity() :: %Spark.Dsl.Entity{ args: term(), auto_set_fields: term(), deprecations: term(), describe: term(), docs: term(), entities: term(), examples: term(), hide: term(), imports: term(), links: term(), modules: term(), name: term(), no_depend_modules: term(), recursive_as: term(), schema: term(), snippet: term(), target: term(), transform: term() }
A Strategy DSL Entity.
See Spark.Dsl.Entity
for more information.
@type strategy() :: struct()
Link to this section Callbacks
@callback transform(strategy(), Spark.Dsl.t()) :: {:ok, strategy()} | {:ok, Spark.Dsl.t()} | {:error, Exception.t()}
If your strategy needs to modify either the entity or the parent resource then you can implement this callback.
This callback can return one of three results:
{:ok, Entity.t}
- an updated DSL entity - useful if you're just changing the entity itself and not changing the wider DSL state of the resource. If this is the response then the transformer will take care of updating the entity in the DSL state.{:ok, Dsl.t}
- an updated DSL state for the entire resource.{:error, Exception.t}
- a compilation-stopping problem was found. Any exception can be returned, but we strongly advise you to return aSpark.Error.DslError
.
@callback verify(strategy(), Spark.Dsl.t()) :: :ok | {:error, Exception.t()}
If your strategy needs to verify either the entity or the parent resource then you can implement this callback.
This is called post-compilation in the @after_verify
hook - see Module
for
more information.
This callback can return one of the following results:
:ok
- everything is A-Okay.{:error, Exception.t}
- a compilation-stopping problem was found. Any exception can be returned, but we strongly advise you to return aSpark.Error.DslError
.