pub struct AppState {
pub config: Arc<IssuerConfig>,
pub base_url: String,
pub store: Arc<dyn OauthStore>,
pub keys: Arc<Keys>,
pub jwks_json: Arc<Value>,
}Expand description
Shared in-memory state for the OAuth2 server.
Holds the issuer configuration, cryptographic keys, and abstract stores.
Fields§
§config: Arc<IssuerConfig>§base_url: String§store: Arc<dyn OauthStore>§keys: Arc<Keys>§jwks_json: Arc<Value>Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(config: IssuerConfig) -> Self
pub fn new(config: IssuerConfig) -> Self
Create a new state with a freshly generated RSA key pair, and an in-memory store.
Sourcepub fn with_store(config: IssuerConfig, store: Arc<dyn OauthStore>) -> Self
pub fn with_store(config: IssuerConfig, store: Arc<dyn OauthStore>) -> Self
Create a new state providing a custom store implementation.
Sourcepub async fn register_client(
&self,
metadata: Value,
) -> Result<Client, OauthError>
pub async fn register_client( &self, metadata: Value, ) -> Result<Client, OauthError>
Register a new client from RFC 7591 metadata JSON.
Sourcepub async fn generate_token(
&self,
client: &Client,
options: JwtOptions,
) -> Result<Token, Error>
pub async fn generate_token( &self, client: &Client, options: JwtOptions, ) -> Result<Token, Error>
Issue a JWT and store it; used by testkit helpers.
Sourcepub fn generate_jwt(
&self,
client: &Client,
options: JwtOptions,
) -> Result<String, Error>
pub fn generate_jwt( &self, client: &Client, options: JwtOptions, ) -> Result<String, Error>
Sign a JWT for the given client; used by testkit helpers.
pub async fn approve_device_code( &self, device_code: &str, user_id: &str, ) -> Option<()>
Sourcepub async fn start(self) -> (SocketAddr, JoinHandle<()>)
pub async fn start(self) -> (SocketAddr, JoinHandle<()>)
Build the Axum router and bind to a TCP listener.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more