Use OIDC username
This commit is contained in:
parent
9888ac4062
commit
3c670d50d3
10 changed files with 154 additions and 43 deletions
|
|
@ -25,3 +25,19 @@ impl service::user_service::UserService for UserServiceDev {
|
|||
Ok("DEVUSER".into())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct UserServiceImpl;
|
||||
|
||||
#[async_trait]
|
||||
impl service::user_service::UserService for UserServiceImpl {
|
||||
type Context = Option<Arc<str>>;
|
||||
|
||||
async fn current_user(
|
||||
&self,
|
||||
context: Self::Context,
|
||||
) -> Result<Arc<str>, service::ServiceError> {
|
||||
context
|
||||
.ok_or_else(|| service::ServiceError::Unauthorized)
|
||||
.map(|user| user.clone())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue