@@ -116,30 +116,29 @@ set an authenticated token in the security context if successful.
116
116
{
117
117
$request = $event->getRequest();
118
118
119
- if (!$request->headers->has('x-wsse')) {
120
- return;
121
- }
119
+ if ($request->headers->has('x-wsse')) {
122
120
123
- $wsseRegex = '/UsernameToken Username="([^"]+)", PasswordDigest="([^"]+)", Nonce="([^"]+)", Created="([^"]+)"/';
121
+ $wsseRegex = '/UsernameToken Username="([^"]+)", PasswordDigest="([^"]+)", Nonce="([^"]+)", Created="([^"]+)"/';
124
122
125
- if (preg_match($wsseRegex, $request->headers->get('x-wsse'), $matches)) {
126
- $token = new WsseUserToken();
127
- $token->setUser($matches[1]);
123
+ if (preg_match($wsseRegex, $request->headers->get('x-wsse'), $matches)) {
124
+ $token = new WsseUserToken();
125
+ $token->setUser($matches[1]);
128
126
129
- $token->digest = $matches[2];
130
- $token->nonce = $matches[3];
131
- $token->created = $matches[4];
127
+ $token->digest = $matches[2];
128
+ $token->nonce = $matches[3];
129
+ $token->created = $matches[4];
132
130
133
- try {
134
- $returnValue = $this->authenticationManager->authenticate($token);
131
+ try {
132
+ $returnValue = $this->authenticationManager->authenticate($token);
135
133
136
- if ($returnValue instanceof TokenInterface) {
137
- return $this->securityContext->setToken($returnValue);
138
- } else if ($returnValue instanceof Response) {
139
- return $event->setResponse($returnValue);
134
+ if ($returnValue instanceof TokenInterface) {
135
+ return $this->securityContext->setToken($returnValue);
136
+ } else if ($returnValue instanceof Response) {
137
+ return $event->setResponse($returnValue);
138
+ }
139
+ } catch (AuthenticationException $e) {
140
+ // you might log something here
140
141
}
141
- } catch (AuthenticationException $e) {
142
- // you might log something here
143
142
}
144
143
}
145
144
0 commit comments