-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add constraint and config options #300
Conversation
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.
Thanks Alex, this looks great. I've not had a chance to look at tests yet but thought I'd hit submit.
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.
Just added some testing notes. The tests look good but I don't think we have yet got sufficient testing.
0aa3a1a
to
e33d033
Compare
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.
Great stuff Alex, this looks really close. Once we've got my comments resolved we'll seek final review from the owning team.
The only thing I notice is missing is the CHANGELOG entry - we can do that before we release the gem, it'll just go under the "Unreleased" header.
4850338
to
8bdc6f6
Compare
Great stuff. This all looks good to me. Let's see if the #govuk-publishing-platform team are happy. I'll drop them a ping. |
- This config allows apps to change the default behaviour of intercepting 401 requests, by including an initialiser: `GDS::SSO.config { |config| config.intercept_401_responses = false }`. For example apps that also include basic http auth would need this option.
8bdc6f6
to
6393469
Compare
- Adds a class so that consumer apps can easily add a permission based constraint.
6393469
to
dbaa00a
Compare
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.
Small non blocking comment but otherwise happy, thanks :)
dbaa00a
to
e128c44
Compare
- Adds a warning log message that the existing PermissionDeniedException should be depracated on a new major release, but it will still work for current apps. The reason is that the new error GDS::SSO::PermissionDeniedError has been created to replace the existing GDS::SSO::ControllerMethods::PermissionDeniedException. Also the new error has been placed on the outer layer of the name-spacing (GDS::SSO), which is more generic than the existing GDS::SSO::ControllerMethods one. And it follows the Rails conventions that the error class names should end with ...Error, which is more indicative that they inherit from StandardError rather than the top level error class Exception. - Updates the Railtie so any rescue errors from PermissionDeniedError will be transformed to :forbidden Rails specific ones.
- All the logic that checks the current_user permissions has been extracted to a separate class, because it will need to be re-used from different parts of the code.
e128c44
to
077e35e
Compare
Adds config for warden to not intercept 401 requests
This config allows apps to change the default behaviour of intercepting 401 requests, by including an initialiser:
GDS::SSO.config { |config| config.intercept_401_responses = false }
.For example apps that also include basic http auth would probably need this option.
Adds authorised user constraint so that consumer apps can easily add a permission based constraint.
Add PermissionDeniedError error class under GDS::SSO namespace and a warning log message that the existing PermissionDeniedException should be deprecated on a new major release.
Extract the user authorisation logic into a separate class and Re-use authorisation logic in the controller_methods class
more info : https://trello.com/c/qb1qpwnr/1369-additional-functionality-to-gds-sso-gem-for-intercepting-401s-and-providing-a-route-constraint