Skip to content
Snippets Groups Projects
Commit ed5f9c03 authored by František Dvořák's avatar František Dvořák
Browse files

Fix token refresh for ownCloud

Access token is provided for rclone as file.
parent c4515aad
Branches
No related tags found
No related merge requests found
...@@ -212,17 +212,23 @@ hub: ...@@ -212,17 +212,23 @@ hub:
async def pre_spawn_hook(self, spawner): async def pre_spawn_hook(self, spawner):
await super(WebDavOIDCSpawner, self).pre_spawn_hook(spawner) await super(WebDavOIDCSpawner, self).pre_spawn_hook(spawner)
auth_state = await self.user.get_auth_state() auth_state = await self.user.get_auth_state()
if "access_token" in auth_state: # volume name as in EGI spawner
token_secret_volume_name = self._expand_user_properties(
self.token_secret_volume_name_template
)
token_path = os.path.join(self.token_mount_path, "access_token")
volume_mounts = [ volume_mounts = [
{"mountPath": "/owncloud:shared", "name": "owncloud"}, {"mountPath": "/owncloud:shared", "name": "owncloud"},
{"mountPath": self.token_mount_path, "name": token_secret_volume_name, "readOnly": True},
] ]
spawner.extra_containers.append( spawner.extra_containers.append(
{ {
"name": "owncloud", "name": "owncloud",
"image": "valtri/webdav-oidc-sidecar:nodaemon6", "image": "valtri/webdav-rclone-sidecar:sha-a59194e",
"args": ["bearer_token_command=cat " + token_path],
"env": [ "env": [
{"name": "WEBDAV_URL", "value": "https://webdav.egi.zcu.cz/webdav-oidc"}, {"name": "WEBDAV_URL", "value": "https://webdav.egi.zcu.cz/webdav-oidc"},
{"name": "WEBDAV_TOKEN", "value": auth_state["access_token"]}, {"name": "WEBDAV_VENDOR", "value": "other"},
{"name": "MOUNT_PATH", "value": "/owncloud"}, {"name": "MOUNT_PATH", "value": "/owncloud"},
], ],
"resources": self.sidecar_resources, "resources": self.sidecar_resources,
...@@ -237,7 +243,7 @@ hub: ...@@ -237,7 +243,7 @@ hub:
"volumeMounts": volume_mounts, "volumeMounts": volume_mounts,
"lifecycle": { "lifecycle": {
"preStop": { "preStop": {
"exec": {"command": ["umount", "-l", "/owncloud"]} "exec": {"command": ["fusermount", "-u", "-z", "/owncloud"]}
}, },
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment