zalando / gin-oauth2

Middleware for Gin Framework users who also want to use OAuth2
MIT License
572 stars 67 forks source link

Provide mutator methods for google.go's oauth2 config. #76

Closed chrishalbert closed 5 months ago

chrishalbert commented 5 months ago

I'm using environment variables to handle my secrets. I was wondering if it would be ok for me to submit mutator methods to support another means of setting the oauth2.Config's in google.go specifically. I'd of course want to ensure this remains backwards compatible, so I would only be adding these setters. Below are the functions I'd like to add:

// Usage would be something like:
google.SetClientID(configs.ClientID)
google.SetClientSecret(configs.ClientSecret)
google.SetRedirectURL(redirectURL)
google.SetScopes([]string{gmail.GmailReadonlyScope})
google.SetEndpoint(google.Endpoint)

If there's no aversion, I'd be happy to submit an PR - with tests too! :)

chrishalbert commented 5 months ago

I didn't see this listed, so I created an issue and went to the PR's to see what feedback I should be aware of, only to find https://github.com/zalando/gin-oauth2/pull/53 🤦 - I can close this, or fix their PR, or open a new one. Whatever it takes to get the addition. Thanks!

szuecs commented 5 months ago

Sounds good @chrishalbert . You can also do something like WithOptions(o Options) and create all the settings you want to set via the Options struct that you would create. Whatever you prefer (takeover the PR or recreate).