This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -28,21 +28,7 @@ async fn main() {
|
||||
.unwrap();
|
||||
let redirect_url = RedirectUrl::new("http://localhost:3000/auth/callback".to_string()).unwrap();
|
||||
|
||||
let oidc_client: oauth2::Client<
|
||||
oauth2::StandardErrorResponse<oauth2::basic::BasicErrorResponseType>,
|
||||
oauth2::StandardTokenResponse<oauth2::EmptyExtraTokenFields, oauth2::basic::BasicTokenType>,
|
||||
oauth2::StandardTokenIntrospectionResponse<
|
||||
oauth2::EmptyExtraTokenFields,
|
||||
oauth2::basic::BasicTokenType,
|
||||
>,
|
||||
oauth2::StandardRevocableToken,
|
||||
oauth2::StandardErrorResponse<oauth2::RevocationErrorResponseType>,
|
||||
oauth2::EndpointSet,
|
||||
oauth2::EndpointNotSet,
|
||||
oauth2::EndpointNotSet,
|
||||
oauth2::EndpointNotSet,
|
||||
oauth2::EndpointSet,
|
||||
> = BasicClient::new(client_id)
|
||||
let oidc_client = BasicClient::new(client_id)
|
||||
.set_client_secret(client_secret)
|
||||
.set_auth_uri(auth_url)
|
||||
.set_token_uri(token_url)
|
||||
@@ -50,13 +36,16 @@ async fn main() {
|
||||
.set_redirect_uri(redirect_url);
|
||||
|
||||
let secret = env::var("SESSION_SECRET")
|
||||
.unwrap_or_else(|_| "your_secret_key".to_string())
|
||||
.unwrap_or_else(|_| "your_secret_key_that_is_long_enough_so_the_library_does_not_complain".to_string())
|
||||
.as_bytes()
|
||||
.to_vec();
|
||||
|
||||
let app_state = AppState { pool, oidc_client };
|
||||
let app_state = AppState {
|
||||
pool: pool.clone(),
|
||||
oidc_client,
|
||||
};
|
||||
|
||||
let app = create_app(app_state, secret, pool.clone()).await;
|
||||
let app = create_app(app_state, secret, pool).await;
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user