Skip to content

Commit

Permalink
Be consistent about issuer instead of domain
Browse files Browse the repository at this point in the history
The variable is supposed to contains `https://`
  • Loading branch information
henrikhorluck committed Feb 28, 2024
1 parent 2542e1e commit 468e471
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions apps/authentication/auth0.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@


def auth0_client():
domain = settings.AUTH0_DOMAIN
issuer = settings.AUTH0_ISSUER

get_token = GetToken(
domain,
issuer,
settings.AUTH0_CLIENT_ID,
client_secret=settings.AUTH0_CLIENT_SECRET,
)
token = get_token.client_credentials(f"https://{domain}/api/v2/")
token = get_token.client_credentials(f"{issuer}/api/v2/")
mgmt_api_token = token["access_token"]

return Auth0(domain, mgmt_api_token)
return Auth0(issuer, mgmt_api_token)
2 changes: 1 addition & 1 deletion apps/authentication/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def provider_logout(request):
"post_logout_redirect_uri": settings.BASE_URL,
# federated might be relevant if we support FEIDE
}
redirect_url = f"{settings.AUTH0_DOMAIN}/oidc/logout?{urlencode(params)}"
redirect_url = f"{settings.AUTH0_ISSUER}/oidc/logout?{urlencode(params)}"
return redirect_url


Expand Down
10 changes: 5 additions & 5 deletions onlineweb4/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ def get_stats_file() -> str:

VIMEO_API_TOKEN = config("OW4_VIMEO_API_TOKEN", default=None)

AUTH0_DOMAIN = config("AUTH0_ISSUER", default="")
AUTH0_ISSUER = config("AUTH0_ISSUER", default="")
AUTH0_CLIENT_ID = config("AUTH0_CLIENT_ID", default="")
AUTH0_CLIENT_SECRET = config("AUTH0_CLIENT_SECRET", default="")

# this OIDC is for non-API-auth
OIDC_OP_JWKS_ENDPOINT = f"{AUTH0_DOMAIN}/.well-known/jwks.json"
OIDC_OP_JWKS_ENDPOINT = f"{AUTH0_ISSUER}/.well-known/jwks.json"
OIDC_RP_SIGN_ALGO = "RS256"
OIDC_RP_CLIENT_ID = AUTH0_CLIENT_ID
OIDC_RP_CLIENT_SECRET = AUTH0_CLIENT_SECRET
OIDC_OP_AUTHORIZATION_ENDPOINT = f"{AUTH0_DOMAIN}/authorize"
OIDC_OP_TOKEN_ENDPOINT = f"{AUTH0_DOMAIN}/oauth/token"
OIDC_OP_USER_ENDPOINT = f"{AUTH0_DOMAIN}/userinfo"
OIDC_OP_AUTHORIZATION_ENDPOINT = f"{AUTH0_ISSUER}/authorize"
OIDC_OP_TOKEN_ENDPOINT = f"{AUTH0_ISSUER}/oauth/token"
OIDC_OP_USER_ENDPOINT = f"{AUTH0_ISSUER}/userinfo"
# https://github.com/mozilla/mozilla-django-oidc/issues/340
# not supported
# OIDC_OP_AUDIENCE = "https://online.ntnu.no"
Expand Down
10 changes: 5 additions & 5 deletions onlineweb4/settings/zappa.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@
SESSION_COOKIE_SAMESITE = None
ADMINS = (("dotKom", "[email protected]"),)

AUTH0_DOMAIN = env["AUTH0_ISSUER"]
AUTH0_ISSUER = env["AUTH0_ISSUER"]
AUTH0_CLIENT_ID = env["AUTH0_CLIENT_ID"]
AUTH0_CLIENT_SECRET = env["AUTH0_CLIENT_SECRET"]

# this OIDC is for non-API-auth
OIDC_OP_JWKS_ENDPOINT = f"{AUTH0_DOMAIN}/.well-known/jwks.json"
OIDC_OP_JWKS_ENDPOINT = f"{AUTH0_ISSUER}/.well-known/jwks.json"
OIDC_RP_CLIENT_ID = AUTH0_CLIENT_ID
OIDC_RP_CLIENT_SECRET = AUTH0_CLIENT_SECRET
OIDC_OP_AUTHORIZATION_ENDPOINT = f"{AUTH0_DOMAIN}/authorize"
OIDC_OP_TOKEN_ENDPOINT = f"{AUTH0_DOMAIN}/oauth/token"
OIDC_OP_USER_ENDPOINT = f"{AUTH0_DOMAIN}/userinfo"
OIDC_OP_AUTHORIZATION_ENDPOINT = f"{AUTH0_ISSUER}/authorize"
OIDC_OP_TOKEN_ENDPOINT = f"{AUTH0_ISSUER}/oauth/token"
OIDC_OP_USER_ENDPOINT = f"{AUTH0_ISSUER}/userinfo"


# Override "spam-settings" for django-wiki
Expand Down

0 comments on commit 468e471

Please sign in to comment.