Last active
November 13, 2021 21:42
-
-
Save baso53/fed6acfc4bdf1ac2f0382b77411ec494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
@RequiredArgsConstructor | |
public class UserManagementService { | |
private final FirebaseAuth firebaseAuth; | |
public void setUserClaims(String uid, List<Permission> requestedPermissions) throws FirebaseAuthException { | |
List<String> permissions = requestedPermissions | |
.stream() | |
.map(Enum::toString) | |
.collect(Collectors.toList()); | |
Map<String, Object> claims = Map.of("custom_claims", permissions); | |
firebaseAuth.setCustomUserClaims(uid, claims); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment