New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added discord provider #2113
base: master
Are you sure you want to change the base?
Added discord provider #2113
Conversation
+1 |
Hi @draeron, I'll have to read some of the discord documentation first before i review this. I'll try to do it next week. |
i have updated my fork with the latest master |
Hi @draeron, sorry for the delay. Due to the latest release and some bugfixes with higher priority I wasn't able to look into your implementation yet. Please do another update / rebase of your PR and add a CHANGELOG entry :) I'll do my best to test your provider implementation this week and give it a first code review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing the test suite for the provider. I tested the discord integration and went through the API documentation. Unfortunately, the group / guild restriction doesn't seem to work.
} | ||
|
||
for _, guild := range guilds { | ||
s.Groups = append(s.Groups, guild.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guild ID are of type snowflake. I would suggest we add another flag for the discord provider to allow groups to be returned either as snowflake or the guild name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Avatar string `json:"avatar"` | ||
// Flags int `json:"flags"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
Do(). | ||
UnmarshalInto(&guilds) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting user's guilds info: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("error getting user's guilds info: %v", err) | |
return nil, fmt.Errorf("error getting user's guilds info: %w", err) |
validateURL: discordDefaultValidateURL, | ||
scope: discordDefaultScope, | ||
}) | ||
p.setAllowedGroups(opts.Guilds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is a problem with the legacy --allowed-group
flag or allowed_groups
config field as it will always overwrite the set values with an empty map map[string]struct {} []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, you will have to add legacy support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm that legacy support is broken right now. --allowed-group doesn't work
Hi @draeron, if you want you can continue working on this and/or you give me collaborator access on your repo and i can work on it as well. Following major todos:
|
I'd also like to contribute. I got it running on my end and would be happy to share what I did plus some additional features like optional email scope (so people don't get scared that an app asks for their email even if it doesn't need it) and Discord role check on a server. If you could add me as a collaborator, I'd love to push my changes to a feature-branch for review @draeron. |
@draeron any chance to update this PR so it meets all the requirements? I built a custom docker image for this now, would be fantastic if this can be merged eventually. |
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
Damn I totally forgot extending and testing this one |
i think this pull request has drifted too much from the master branch, imho it would need to be redone completely |
Enable discord provider with filtering based on guilds membership.
You can use both structured Alpha configuration or
--allowed-group
options.