forked from Github-Mirrors/canaille
fix: return a 403 error when users are missing permissions for OIDC authentication
This commit is contained in:
parent
cccbafeb0e
commit
97394823bf
2 changed files with 4 additions and 4 deletions
|
@ -48,11 +48,11 @@ def authorize():
|
|||
)
|
||||
|
||||
if "client_id" not in request.args:
|
||||
abort(400)
|
||||
abort(400, "client_id parameter is missing.")
|
||||
|
||||
client = models.Client.get(client_id=request.args["client_id"])
|
||||
if not client:
|
||||
abort(400)
|
||||
abort(400, "Invalid client.")
|
||||
|
||||
user = current_user()
|
||||
scopes = client.get_allowed_scope(request.args.get("scope", "").split(" ")).split(
|
||||
|
@ -69,7 +69,7 @@ def authorize():
|
|||
return redirect(url_for("core.auth.login"))
|
||||
|
||||
if not user.can_use_oidc:
|
||||
abort(400)
|
||||
abort(403, "User does not have the permission to achieve OIDC authentication.")
|
||||
|
||||
# CONSENT
|
||||
|
||||
|
|
|
@ -607,7 +607,7 @@ def test_authorization_code_flow_but_user_cannot_use_oidc(
|
|||
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(status=302)
|
||||
res = res.follow(status=400)
|
||||
res = res.follow(status=403)
|
||||
|
||||
|
||||
def test_prompt_none(testclient, logged_user, client):
|
||||
|
|
Loading…
Reference in a new issue