mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-21 00:22:57 +00:00
Add OIDC CustomClaims struct.
This is needed when custom claims are returned that are not used by ChirpStack, but might be used during user registration.
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
@ -7,12 +8,13 @@ use openidconnect::core::{
|
|||||||
CoreResponseType,
|
CoreResponseType,
|
||||||
};
|
};
|
||||||
use openidconnect::reqwest::async_http_client;
|
use openidconnect::reqwest::async_http_client;
|
||||||
|
use openidconnect::{AdditionalClaims, UserInfoClaims};
|
||||||
use openidconnect::{
|
use openidconnect::{
|
||||||
AuthenticationFlow, AuthorizationCode, ClientId, ClientSecret, CsrfToken, IssuerUrl, Nonce,
|
AuthenticationFlow, AuthorizationCode, ClientId, ClientSecret, CsrfToken, IssuerUrl, Nonce,
|
||||||
OAuth2TokenResponse, RedirectUrl, Scope,
|
OAuth2TokenResponse, RedirectUrl, Scope,
|
||||||
};
|
};
|
||||||
use openidconnect::{EmptyAdditionalClaims, UserInfoClaims};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use serde_json::Value;
|
||||||
use tracing::{error, trace};
|
use tracing::{error, trace};
|
||||||
use warp::{Rejection, Reply};
|
use warp::{Rejection, Reply};
|
||||||
|
|
||||||
@ -20,7 +22,15 @@ use crate::config;
|
|||||||
use crate::helpers::errors::PrintFullError;
|
use crate::helpers::errors::PrintFullError;
|
||||||
use crate::storage::{get_async_redis_conn, redis_key};
|
use crate::storage::{get_async_redis_conn, redis_key};
|
||||||
|
|
||||||
pub type User = UserInfoClaims<EmptyAdditionalClaims, CoreGenderClaim>;
|
pub type User = UserInfoClaims<CustomClaims, CoreGenderClaim>;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct CustomClaims {
|
||||||
|
#[serde(flatten)]
|
||||||
|
other: HashMap<String, Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AdditionalClaims for CustomClaims {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct CallbackArgs {
|
pub struct CallbackArgs {
|
||||||
|
Reference in New Issue
Block a user