oxide_auth/lib.rs
1//! # oxide-auth
2//!
3//! An OAuth2 server library, for use in combination with actix-web or other front-ends, featuring a
4//! set of configurable and pluggable back-ends.
5//!
6//! ## About
7//!
8//! `oxide-auth` aims at providing a comprehensive and extensible interface to managing OAuth2
9//! tokens on a server. This depends on both a front-end facing web server for network operations
10//! and a back-end implementation for policies and data storage. The main interface is designed
11//! around traits in both directions, so that the front-end is as easily pluggable as the back-end.
12//! There are many adaptations for specific web server crates (`actix`, `rocket`, `iron`,
13//! `rouille`) in associated crates
14//!
15//! ## Create a web server with OAuth security
16//!
17//! So you want to build a new OAuth provider? Instead of only relying on tokens provided by other
18//! large internet entities, you want to make your own tokens? Examples of this use case: A web
19//! facing data portal, automation endpoints (in the style of Reddit or Discord), or even to
20//! restrict the authorization of different components of your own software by applying these
21//! techniques to your `REST`/`GraphQL`/.. back-end.
22//!
23//! Choose one of the available adaptor crates, a complete list can be found in the [`frontends`]
24//! module, or translate the HTTP to the generic software endpoint found in [`frontends::simple`].
25//!
26//! Next, a set of [`primitives`] needs to be chosen. These will depend on the policies need for
27//! Your use case but will in general encompass a [`Registrar`], an [`Authorizer`], and an
28//! [`Issuer`]. There is a simple, in-memory implementation provided for each of those. More
29//! complex solutions might require a customized trait implementation especially when specific
30//! cryptographic standards or consistency requirements are needed. (It would be appreciated if
31//! those were shared with the community as an open-source project, for example as a complementary
32//! crate, but not mandatory).
33//!
34//! And finally, an implementation of an [`Endpoint`] is required, handling the request type that
35//! has been chosen and forwarding it to the primitives. In very simple cases this can be an
36//! instantiation of the [`Generic`] struct. But for most complex cases it should instead be a
37//! custom trait implementation that is tailored to Your specific requirements. Besides the
38//! previously chosen primitives, the endpoint require You to choose two more interface: An
39//! [`OwnerSolicitor`] to interact with Your session handling, user consent, and CSRF protection;
40//! and the [`Scopes`] deciding required permissions for a request.
41//!
42//! ## Custom Front-Ends
43//!
44//! A key feature is the ability to add your own front-end without jeopardizing safety
45//! requirements. For example to add your in-house server and request representation! This requires
46//! custom, related implementations of [`WebRequest`] and [`WebResponse`]. In theory, you are not
47//! even restricted to HTTP as long as the parameters can be transmitted safely. _WARNING_: Custom
48//! front-ends MUST ensure a secure transportation layer with confidential clients. This means
49//! using TLS for communication over HTTPS.
50//!
51//! For more information, see the documentation of [`endpoint`] and [`frontends`].
52//!
53//! [`WebRequest`]: code_grant/frontend/trait.WebRequest.html
54//! [`WebResponse`]: code_grant/frontend/trait.WebResponse.html
55//! [`endpoint`]: endpoint/index.html
56//! [`Endpoint`]: endpoint/trait.Endpoint.html
57//! [`frontends`]: frontends/index.html
58//! [`frontends::simple`]: frontends/simple/index.html
59//! [`Generic`]: frontends/simple/endpoint/struct.Generic.html
60//! [`primitives`]: primitives/index.html
61//! [`Registrar`]: primitives/registrar/trait.Registrar.html
62//! [`Authorizer`]: primitives/authorizer/trait.Authorizer.html
63//! [`Issuer`]: primitives/issuer/trait.Issuer.html
64//! [`OwnerSolicitor`]: endpoint/trait.OwnerSolicitor.html
65//! [`Scopes`]: endpoint/trait.Scopes.html
66#![warn(missing_docs)]
67
68pub mod code_grant;
69pub mod endpoint;
70pub mod frontends;
71pub mod primitives;