Module primitives

Source
Expand description

A collection of primites useful for more than one authorization method.

A primitive is the smallest independent unit of policy used in OAuth related endpoints. For example, an authorizer generates and verifies Authorization Codes. There only is, as you might have noticed, only the OAuth2 code grant method. But abstracting away the underlying primitives makes it possible to provide –e.g.– a independent database based implementation.

These should be used to build or instantiate an Endpoint, for example Generic or your own.

use oxide_auth::frontends::simple::endpoint::Generic;
use oxide_auth::primitives::{
    authorizer::AuthMap,
    generator::RandomGenerator,
    issuer::TokenMap,
    registrar::ClientMap,
};

Generic {
    authorizer: AuthMap::new(RandomGenerator::new(16)),
    registrar: ClientMap::new(),
    issuer: TokenMap::new(RandomGenerator::new(16)),
    // ...
};

Modules§

authorizer
Authorizers are need to exchange code grants for bearer tokens.
generator
Generators produce string code grant and bearer tokens for a determined grant.
grant
Encapsulates various shared mechanisms for handlings different grants.
issuer
Generates bearer tokens and refresh tokens.
prelude
Commonly used primitives for frontends and backends.
registrar
Registrars administer a database of known clients.
scope
Defines the Scope type and parsing/formatting according to the rfc.