Skip to content

Minor improvement: Cleaned up the WsseListener example #1686

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

Merged
merged 1 commit into from
Sep 14, 2012
Merged

Minor improvement: Cleaned up the WsseListener example #1686

merged 1 commit into from
Sep 14, 2012

Conversation

dol
Copy link

@dol dol commented Sep 6, 2012

Refactoring the WsseListener

  • AuthenticationManagerInterface will never return a Response, instanceof check is obsolete
  • Added option to redirect to the login page by clear the token of the securityContext

if ($request->headers->has('x-wsse')) {
if (!$request->headers->has('x-wsse')) {
throw new BadCredentialsException('Missing mandatory WSSE header');
}
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. It makes this listener impossible to use with others authentication listeners as the exception will prevent them from running. If you cannot authenticate the user for this request, you should simply do nothing.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, thank you for the tip. A 'return' should do the trick?
Good to know, I have to update the Listener in our code base.

Copy link
Member

Choose a reason for hiding this comment

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

yes

Refactoring the WsseListener
* AuthenticationManagerInterface will never return a Response, instanceof check is obsolete
* Added option to redirect to the login page by clear the token of the securityContext
$returnValue = $this->authenticationManager->authenticate($token);
$this->securityContext->setToken($authToken);
} catch (AuthenticationException $failed) {
// you might log something here
Copy link
Member

Choose a reason for hiding this comment

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

This should be

// ... you might log something here

weaverryan added a commit that referenced this pull request Sep 14, 2012
…provider

Minor improvement: Cleaned up the WsseListener example
@weaverryan weaverryan merged commit de4085a into symfony:2.0 Sep 14, 2012
weaverryan added a commit that referenced this pull request Sep 14, 2012
@weaverryan
Copy link
Member

Hi Dominic!

These are really great changes! I've merged them in with basically no changes :)

Thanks for the great PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants