Skip to content

Commit

Permalink
Escape user and group names in issued tokens (PelicanPlatform#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianaydemir committed Dec 6, 2024
1 parent db96b8b commit bc2f2b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions oa4mp/resources/policies.qdl
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ scopes := {};
while [has_value(key, group_list.)]
[
group_scopes := { {{- range $idx, $action := .Actions }}{{- if eq $idx 0 -}}'{{- $action -}}:'{{else}}, '{{- $action -}}:'{{- end -}}{{ end -}} } + '{{- .Prefix -}}';
scopes := scopes \/ |^replace(~group_scopes, '$GROUP', key);
scopes := scopes \/ |^replace(~group_scopes, '$GROUP', encode(key, 1)); /* 1 = URL-encode (RFC 3986) */
];
{{- end }}
{{ range .UserAuthzTemplates }}
user_scopes := { {{- range $idx, $action := .Actions }}{{- if eq $idx 0 -}}'{{- $action -}}:'{{else}}, '{{- $action -}}:'{{- end -}}{{ end -}} } + '{{- .Prefix -}}';
scopes := scopes \/ |^replace(~user_scopes, '$USER', claims.'sub');
scopes := scopes \/ |^replace(~user_scopes, '$USER', encode(claims.'sub', 1)); /* 1 = URL-encode (RFC 3986) */
{{ end }}
access_token.'scope' := detokenize(scopes, ' ', 2);

Expand Down

0 comments on commit bc2f2b2

Please sign in to comment.