Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Follow Symfony naming convention when naming roles
Browse files Browse the repository at this point in the history
  • Loading branch information
PBXg33k committed Feb 7, 2017
1 parent ea78cf8 commit 1f18305
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Authenticator/Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ public function setUserRolesFromAudienceClaims(UserInterface $user, TokenInterfa
if ($claimKey === 'aud') {
if (is_array($claimValue)) {
foreach ($claimValue as $role) {
$user->addRole($role);
$user->addRole("ROLE_" . strtoupper($role));
}
} elseif (is_string($claimValue)) {
$user->addRole($claimValue);
$user->addRole("ROLE_" . strtoupper($claimValue));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Authenticator/AuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ public function willAddRolesFromAudienceClaimsInToken()

$user->expects($this->once())
->method('addRole')
->with('guests');
->with('ROLE_GUESTS');

$user->expects($this->once())
->method('getRoles')
->willReturn(['guests']);
->willReturn(['ROLE_GUESTS']);

$authenticator->authenticateToken($anonToken, $userProvider, 'myprovider');
}
Expand Down

0 comments on commit 1f18305

Please sign in to comment.