Remove auth for client info retrieval
This commit is contained in:
parent
8e2dd0e3b7
commit
3c61d2308f
2520
js/ui/package-lock.json
generated
2520
js/ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@
|
||||
let client_metadata = {};
|
||||
onMount(async () => {
|
||||
try {
|
||||
client_metadata = JSON.parse(await fetch(`${window.location.origin}/client/${client_id}`));
|
||||
client_metadata = fetch(`${window.location.origin}/client/${client_id}`).then((response) => response.json());
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
@ -211,14 +211,9 @@ async fn userinfo(
|
||||
|
||||
async fn clientinfo(
|
||||
Path(client_id): Path<String>,
|
||||
bearer: Option<TypedHeader<Authorization<Bearer>>>,
|
||||
Extension(redis_client): Extension<RedisClient>,
|
||||
) -> Result<Json<CoreClientMetadata>, CustomError> {
|
||||
Ok(
|
||||
oidc::clientinfo(client_id, bearer.map(|b| b.0 .0), &redis_client)
|
||||
.await?
|
||||
.into(),
|
||||
)
|
||||
Ok(oidc::clientinfo(client_id, &redis_client).await?.into())
|
||||
}
|
||||
|
||||
async fn client_update(
|
||||
|
@ -689,10 +689,13 @@ async fn client_access(
|
||||
|
||||
pub async fn clientinfo(
|
||||
client_id: String,
|
||||
bearer: Option<Bearer>,
|
||||
db_client: &DBClientType,
|
||||
) -> Result<CoreClientMetadata, CustomError> {
|
||||
Ok(client_access(client_id, bearer, db_client).await?.metadata)
|
||||
Ok(db_client
|
||||
.get_client(client_id)
|
||||
.await?
|
||||
.ok_or(CustomError::NotFound)?
|
||||
.metadata)
|
||||
}
|
||||
|
||||
pub async fn client_delete(
|
||||
|
@ -255,15 +255,9 @@ pub async fn main(req: Request, env: Env) -> Result<Response> {
|
||||
} else {
|
||||
return Response::error("Bad Request", 400);
|
||||
};
|
||||
let bearer = req
|
||||
.headers()
|
||||
.get(Authorization::<Bearer>::name().as_str())?
|
||||
.and_then(|b| HeaderValue::from_str(b.as_ref()).ok())
|
||||
.as_ref()
|
||||
.and_then(Bearer::decode);
|
||||
let url = req.url()?;
|
||||
let db_client = CFClient { ctx, url };
|
||||
match oidc::clientinfo(client_id, bearer, &db_client).await {
|
||||
match oidc::clientinfo(client_id, &db_client).await {
|
||||
Ok(r) => Ok(Response::from_json(&r)?),
|
||||
Err(e) => e.into(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user