ExOauth2Provider v0.4.4 ExOauth2Provider.OauthAccessGrants View Source
The boundary for the OauthAccessGrants system.
Link to this section Summary
Link to this section Functions
Link to this function
create_grant(resource_owner, application, attrs)
View Source
create_grant(resource_owner, application, attrs)
View Source
create_grant(
Ecto.Schema.t(),
ExOauth2Provider.OauthApplications.OauthApplication.t(),
map()
) ::
{:ok, ExOauth2Provider.OauthAccessGrants.OauthAccessGrant.t()}
| {:error, term()}
create_grant( Ecto.Schema.t(), ExOauth2Provider.OauthApplications.OauthApplication.t(), map() ) :: {:ok, ExOauth2Provider.OauthAccessGrants.OauthAccessGrant.t()} | {:error, term()}
Creates an access grant.
Examples
iex> create_grant(resource_owner, application, attrs)
{:ok, %OauthAccessGrant{}}
iex> create_grant(resource_owner, application, attrs)
{:error, %Ecto.Changeset{}}
Link to this function
filter_expired(data)
View Source
filter_expired(data)
View Source
filter_expired(Ecto.Schema.t()) :: Ecto.Schema.t() | nil
filter_expired(Ecto.Schema.t()) :: Ecto.Schema.t() | nil
Filter expired data.
Examples
iex> filter_expired(%Data{expires_in: 7200, inserted_at: ~N[2017-04-04 19:21:22.292762], ...}}
%Data{}
iex> filter_expired(%Data{expires_in: 10, inserted_at: ~N[2017-04-04 19:21:22.292762], ...}}
nil
Link to this function
filter_revoked(data)
View Source
filter_revoked(data)
View Source
filter_revoked(Ecto.Schema.t()) :: Ecto.Schema.t() | nil
filter_revoked(Ecto.Schema.t()) :: Ecto.Schema.t() | nil
Filter revoked data.
Examples
iex> filter_revoked(%Data{revoked_at: nil, ...}}
%Data{}
iex> filter_revoked(%Data{revoked_at: ~N[2017-04-04 19:21:22.292762], ...}}
nil
Link to this function
get_active_grant_for(application, token)
View Source
get_active_grant_for(application, token)
View Source
get_active_grant_for(
ExOauth2Provider.OauthApplications.OauthApplication.t(),
binary()
) :: ExOauth2Provider.OauthAccessGrants.OauthAccessGrant.t() | nil
get_active_grant_for( ExOauth2Provider.OauthApplications.OauthApplication.t(), binary() ) :: ExOauth2Provider.OauthAccessGrants.OauthAccessGrant.t() | nil
Gets a single access grant registered with an application.
Examples
iex> get_active_grant_for(application, "jE9dk")
%OauthAccessGrant{}
iex> get_active_grant_for(application, "jE9dk")
** nil
Link to this function
is_expired?(arg1)
View Source
is_expired?(arg1)
View Source
is_expired?(Ecto.Schema.t() | nil) :: boolean()
is_expired?(Ecto.Schema.t() | nil) :: boolean()
Checks if data has expired.
Examples
iex> is_expired?(%Data{expires_in: 7200, inserted_at: ~N[2017-04-04 19:21:22], ...}}
false
iex> is_expired?(%Data{expires_in: 10, inserted_at: ~N[2017-04-04 19:21:22], ...}}
true
iex> is_expired?(%Data{expires_in: nil}}
false
Link to this function
is_revoked?(arg1)
View Source
is_revoked?(arg1)
View Source
is_revoked?(Ecto.Schema.t()) :: boolean()
is_revoked?(Ecto.Schema.t()) :: boolean()
Checks if data has been revoked.
Examples
iex> is_revoked?(%Data{revoked_at: nil, ...}}
false
iex> is_revoked?(%Data{revoked_at: ~N[2017-04-04 19:21:22.292762], ...}}
true
Link to this function
parse_default_scope_string(server_scopes) View Source
Link to this function
put_scopes(changeset)
View Source
put_scopes(changeset)
View Source
put_scopes(Ecto.Changeset.t()) :: Ecto.Changeset.t()
put_scopes(Ecto.Changeset.t()) :: Ecto.Changeset.t()
Link to this function
put_scopes(changeset, default_server_scopes) View Source
Link to this function
revoke(data)
View Source
revoke(data)
View Source
revoke(Ecto.Schema.t()) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
revoke(Ecto.Schema.t()) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
Revoke data.
Examples
iex> revoke(data)
{:ok, %Data{revoked_at: ~N[2017-04-04 19:21:22.292762], ...}}
iex> revoke(invalid_data)
{:error, %Ecto.Changeset{}}
Link to this function
revoke!(data)
View Source
revoke!(data)
View Source
revoke!(Ecto.Schema.t()) :: Ecto.Schema.t() | no_return()
revoke!(Ecto.Schema.t()) :: Ecto.Schema.t() | no_return()
Same as revoke/1
but raises error.
Link to this function
validate_scopes(changeset)
View Source
validate_scopes(changeset)
View Source
validate_scopes(Ecto.Changeset.t()) :: Ecto.Changeset.t()
validate_scopes(Ecto.Changeset.t()) :: Ecto.Changeset.t()
Link to this function