Skip to content
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

sdk: add consent helper - closes #397 #398

Merged
merged 4 commits into from
Mar 24, 2017
Merged

sdk: add consent helper - closes #397 #398

merged 4 commits into from
Mar 24, 2017

Conversation

aeneasr
Copy link
Member

@aeneasr aeneasr commented Mar 22, 2017

No description provided.

@aeneasr aeneasr added the feat New feature or request. label Mar 22, 2017
sdk/consent.go Outdated
}

// GenerateResponse generates a consent response and returns the consent response token, or an error if it is invalid.
func (c *Consent) GenerateResponse(r *ResponseRequest) (string, error) {
Copy link
Member Author

@aeneasr aeneasr Mar 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of returning the consent response token here, we could probably return the URL instead. The former requires us to do something like this:

response, err := c.GenerateResponse(/* ... */)
http.Redirect(r,w,claims.RedirectURL + "&consent=" + response)

while the latter would allow for an easier flow:

redirectURL, err := c.GenerateResponse(/* ... */)
http.Redirect(r,w redirectURL)

To deny consent, the idea is to have:

redirectURL, err := c.DenyConsent(/* ... */)
http.Redirect(r,w redirectURL)

Currently this would be possible with:

http.Redirect(r,w,claims.RedirectURL + "&consent=deny")

@aeneasr aeneasr merged commit 93bb521 into master Mar 24, 2017
@aeneasr aeneasr deleted the close-397 branch March 24, 2017 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant