Skip to content

Commit

Permalink
Merge pull request #43 from rabobank/support-ampersand
Browse files Browse the repository at this point in the history
Support for & in group name
  • Loading branch information
nielsdt-rabobank authored Jan 23, 2024
2 parents b05f9b4 + bc4b1ce commit a9d4308
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions azureAD/azureAD.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ func (m *Manager) GraphGetGroupMembers(token, groupName string) ([]string, error
func graphGetIdFromName(token, name string) (string, error) {
// Some magic because the filter uses spaces and single quotes.
// Spaces MUST be encoded as %20 (not +, as is the default for go)
spaceEncodedString := "$select=id&$filter=displayName eq '" + url.QueryEscape(name) + "'"
t := &url.URL{Path: spaceEncodedString}
requestURL := GraphURL + "groups?" + t.String()
// Ugly code, but both url.Url and QueryEscape do not exactly what we want.
beginString := "$select=id&$filter=displayName eq '"
endString := "'"

t := &url.URL{Path: beginString}
u := &url.URL{Path: endString}
requestURL := GraphURL + "groups?" + t.String() + url.QueryEscape(name) + u.String()

headers := make(map[string]string)
headers["Authorization"] = "Bearer " + token
Expand Down

0 comments on commit a9d4308

Please sign in to comment.