Skip to content

Commit

Permalink
fix(jans-cedarling): fix token handling (#10761)
Browse files Browse the repository at this point in the history
* feat(jans-cedarling): fix tokens input

Signed-off-by: SafinWasi <[email protected]>

* chore: update dockerfile

Signed-off-by: SafinWasi <[email protected]>

---------

Signed-off-by: SafinWasi <[email protected]>
  • Loading branch information
SafinWasi authored Jan 30, 2025
1 parent c342a05 commit 2533e30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jans-cedarling/flask-sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN pip3 install "poetry==$POETRY_VERSION" gunicorn \
# ===============
# Project setup
# ===============
ENV JANS_SOURCE_VERSION=81b061d8a2777afafe3ea9b36859561715da5839
ENV JANS_SOURCE_VERSION=0e628d72acbb674d9ea1fc2a290d010ef603ed24

COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
Expand Down
11 changes: 8 additions & 3 deletions jans-cedarling/flask-sidecar/main/base/cedarling/cedarling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from cedarling_python import (
ResourceData,
Request,
AuthorizeResultResponse,
Tokens
AuthorizeResultResponse
)
from main.logger import logger
from flask import Flask
Expand Down Expand Up @@ -119,7 +118,13 @@ def authorize(self,
id_token = subject["properties"].get("id_token", None)
userinfo_token = subject["properties"].get("userinfo_token", None)
try:
tokens = Tokens(access_token, id_token, userinfo_token)
tokens={}
if access_token is not None:
tokens["access_token"] = access_token
if id_token is not None:
tokens["id_token"] = id_token
if userinfo_token is not None:
tokens["userinfo_token"] = userinfo_token
request = Request(tokens, action_entity, resource_entity, context)
authorize_result = self._cedarling.authorize(request)
except Exception as e:
Expand Down

0 comments on commit 2533e30

Please sign in to comment.