Skip to content

Commit b5cb833

Browse files
committed
stop using the oidc standard claim address for profile location, use bornhack:v2:location custom claim instead, require location:read scope to get the claim
1 parent 6dcae85 commit b5cb833

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/bornhack/oauth_validators.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class BornhackOAuth2Validator(OAuth2Validator):
2121
# the custom user claims we support, and the (mostly custom) scopes they require
2222
"bornhack:v2:description": "profile",
2323
"bornhack:v2:groups": "groups:read",
24+
"bornhack:v2:location": "location:read",
2425
"bornhack:v2:permissions": "permissions:read",
2526
"bornhack:v2:public_credit_name": "profile",
2627
"bornhack:v2:teams": "teams:read",
@@ -78,7 +79,7 @@ def get_additional_claims(self, request) -> dict[str, str | list[dict[str, str]]
7879

7980
# include location?
8081
if request.user.profile.location:
81-
claims["address"] = {"formatted": request.user.profile.location}
82+
claims["bornhack:v2:location"] = request.user.profile.location
8283

8384
# include phonenumber?
8485
if request.user.profile.phonenumber:
@@ -97,7 +98,6 @@ def get_discovery_claims(self, request) -> list[str]:
9798
"""
9899
return [
99100
# OIDC standard claims
100-
"address",
101101
"email",
102102
"email_verified",
103103
"nickname",
@@ -108,6 +108,7 @@ def get_discovery_claims(self, request) -> list[str]:
108108
# custom user claims
109109
"bornhack:v2:description",
110110
"bornhack:v2:groups",
111+
"bornhack:v2:location",
111112
"bornhack:v2:permissions",
112113
"bornhack:v2:public_credit_name",
113114
"bornhack:v2:teams",

src/bornhack/settings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,22 @@
221221
"SCOPES": {
222222
# required
223223
"openid": "OpenID Connect scope",
224+
224225
# deprecated api scope, remove after 2025 camp
225226
"profile:read": "Allow the remote site to read your bornhack.dk username (uuid), user id, profile public credit name, profile description, and a list of team memberships using the profile API endpoint (scope profile:read). NOTE: This scope is being deprecated soon! Ask the BornHack website team for more info.",
227+
226228
# standard OIDC claim scopes
227229
"profile": "Allow the remote site to read your profile public_credit_name, description, and update time (scope: profile)",
228230
"email": "Allow the remote site to read your email address (scope: email)",
229231
"address": "Allow the remote site to read your profile location (scope: address)",
230232
"phone": "Allow the remote site to read your profile phonenumber (scope: phone)",
233+
231234
# custom bornhack user claim scopes
232235
"groups:read": "Allow the remote site to read a list of your group memberships (scope: groups:read).",
236+
"location:read": "Allow the remote site to read your profile location (scope: loocation:read)",
233237
"permissions:read": "Allow the remote site to read a list of your assigned permissions (scope: permissions:read).",
234-
"teams:read": "Allow the remote site to read a list of your team memberships and team lead status (scope: teams)",
238+
"teams:read": "Allow the remote site to read a list of your team memberships and team lead status (scope: teams:read)",
239+
235240
# api scopes
236241
"phonebook:admin": "Allow the remote site to read the camp phonebook, including service numbers and unlisted numbers. Also allow the remote site to use to the POC API. This scope is only relevant for POC team leads (scope: phonebook:admin).",
237242
"phonebook:read": "Allow the remote site to read the camp phonebook (scope: phonebook:read).",

0 commit comments

Comments
 (0)