Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit refresh token for oidc #19

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions kustomizations/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: inttw-vk
image: ghcr.io/intertwin-eu/virtual-kubelet-inttw:0.0.1-pre9
image: ghcr.io/intertwin-eu/virtual-kubelet-inttw:0.0.1-pre11
imagePullPolicy: Always
args:
- --nodename
Expand Down Expand Up @@ -64,7 +64,7 @@ spec:
cpu: 2000m
memory: 2Gi
- name: refresh-token
image: ghcr.io/intertwin-eu/virtual-kubelet-inttw-refresh:0.0.1-pre9
image: ghcr.io/intertwin-eu/virtual-kubelet-inttw-refresh:0.0.1-pre11
imagePullPolicy: Always
env:
- name: IAM_SERVER
Expand All @@ -74,6 +74,8 @@ spec:
value: "DUMMY"
- name: IAM_CLIENT_SECRET
value: "DUMMY"
- name: IAM_REFRESH_TOKEN
value: "DUMMY"
- name: IAM_VK_AUD
value: intertw-vk
- name: TOKEN_PATH
Expand Down
11 changes: 6 additions & 5 deletions scripts/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"IAM_SERVER", "https://cms-auth.web.cern.ch/")
iam_client_id = os.environ.get("IAM_CLIENT_ID")
iam_client_secret = os.environ.get("IAM_CLIENT_SECRET")
iam_refresh_token = os.environ.get("IAM_REFRESH_TOKEN")
audience = os.environ.get("IAM_VK_AUD")
output_file = os.environ.get("TOKEN_PATH", "/opt/interlink/token")
except Exception as ex:
Expand All @@ -31,11 +32,11 @@
request_data = {
"client_id": iam_client_id,
"client_secret": iam_client_secret,
"grant_type": "client_credentials",
"username": "not_needed",
"password": "not_needed",
"scope": "openid profile email iam groups groups:intw",
"aud": audience
"grant_type": "refresh_token",
"username": iam_client_id,
"password": iam_client_secret,
"refresh_token": iam_refresh_token,
"scope": "openid profile email address phone offline_access"
}
r = requests.post(iam_server+"token", data=request_data)
response = json.loads(r.text)
Expand Down