Gabriel Zachmann, Marcus Hardt
Jan 2023
oidc-agentoidc-agentssh-agent is intentional:
oidc-gen: Generate an OIDC configurationoidc-add: Load an OIDC configurationoidc-token: Obtain OIDC Access Tokensoidc-agent uses Refresh Tokens
Once in a life time (~1 Year): Create a
configuration: (triggers an auth-code-flow;
device-code-flow is also supported)
Once per reboot: Load encrypted configuration into memory (triggers password prompt; GUI or cmdline; May be skipped)
Often: Obtain token:
(Auto-adds
config, when oidc-add was skipped)
“Authenticated access to remote services”
URL=https://proxy.eduteams.org; \
curl $URL/OIDC/userinfo -H "Authorization: Bearer `oidc-token $URL`" | jq oidc-agent

mytokenmytokenmytoken server: Obtains
Refresh Token via authorisation code flow.mytoken”Refresh Tokens (stay on server) are
encrypted with mytoken (given to
client)mytokens are jwt style
tokens, that


mytoken:
mytoken obtained in
$MYTOKENInspect the mytoken:
{
"alg": "ES512",
"typ": "MT+JWT"
}
{
"ver": "0.6",
"token_type": "mytoken",
"iss": "https://mytoken.data.kit.edu/",
"sub": "N071dtAYzya4W32aHGXaze07ywqKMZ/2B2MSVY4uBuw=",
"seq_no": 1,
"aud": "https://mytoken.data.kit.edu/",
"oidc_sub": "7ca006d6b7e61023cec493a74e57849ae9145815@eduteams.org",
"oidc_iss": "https://proxy.eduteams.org",
"exp": 1674835490,
"nbf": 1674144337,
"iat": 1674144337,
"auth_time": 1674144337,
"jti": "0502ae85-1dde-44a0-8965-5db2360fe4ed",
[...]
}Inspect the mytoken (continued)
Get an Access Token from a mytoken:
{
"alg": "RS256",
"typ": "JWT",
"kid": "PUYOirA3Y-d_dGpdj4iJDHw4zHa8IY-bhZdaEj0rjbU"
}
{
"exp": 1673967087,
"iat": 1673963487,
"auth_time": 1673958960,
"jti": "8ff30cdd-cbab-4ee8-bf9d-5e219fd55324",
"iss": "https://aai.egi.eu/auth/realms/egi",
"sub": "d7a53cbe3e966c53ac64fde7355956560282158ecac8f3d2c770b474862f4756@egi.eu",
"typ": "Bearer",
"azp": "mytoken",
"session_state": "9336c983-befa-476c-b494-82a49f04d661",
"scope": "openid eduperson_unique_id eduperson_scoped_affiliation eduperson_entitlement cert_entitlement ssh_public_key profile email orcid",
"sid": "9336c983-befa-476c-b494-82a49f04d661",
"authenticating_authority": "https://idp.scc.kit.edu/idp/shibboleth"
}mytokenmytokens can be adjusted to the situation in which they
are usedmytokens can be as safe as possible – and as unsafe as
necessarymytokens can be revokedmytokens can mostly be used just as any other OIDC JWT
tokenmytoken server https://mytoken.data.kit.edu will soon be hosted
according to the EugridPMA
Credential Store.

Require an authenticated user
Require an authenticated user to carry two entitlements
# The user needs belong to a certain virtual organisation
vo_requirement = get_vo_requirement(
[
"urn:geant:eduteams.org:service:eduteams:group:LAGO-AAI",
"urn:geant:eduteams.org:service:eduteams:group:eduTEAMS",
],
"eduperson_entitlement",
match=2,
)
@app.get("/authorized_vo")
@flaat.requires(vo_requirement)
def authorized_vo(request: Request):
return "This worked: user has the required entitlement(s)"flaat