Added setRoles
This commit is contained in:
parent
778a7cba0b
commit
6731b8f6a6
|
@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for Authorization utils
|
||||
|
||||
## [v1.0.1-SNAPSHOT]
|
||||
|
||||
- Fixed getRoles for JWTSecret [#22754]
|
||||
-
|
||||
|
||||
## [v1.0.0]
|
||||
|
||||
- First Release
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-utils</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.common.authorization.utils.user;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -66,8 +67,9 @@ public class GCubeUser implements User {
|
|||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(Set<String> roles) {
|
||||
this.roles = roles;
|
||||
@Override
|
||||
public void setRoles(Collection<String> roles) {
|
||||
this.roles = new HashSet<>(roles);
|
||||
}
|
||||
@Override
|
||||
public String getGivenName() {
|
||||
|
|
|
@ -15,6 +15,9 @@ public class KeycloakUser extends AccessToken implements User {
|
|||
*/
|
||||
private static final long serialVersionUID = -7083648026885406300L;
|
||||
|
||||
protected Collection<String> roles;
|
||||
|
||||
|
||||
@Override
|
||||
@JsonIgnore
|
||||
public String getUsername() {
|
||||
|
@ -24,7 +27,13 @@ public class KeycloakUser extends AccessToken implements User {
|
|||
@Override
|
||||
@JsonIgnore
|
||||
public Collection<String> getRoles() {
|
||||
return getRealmAccess().getRoles();
|
||||
return roles;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonIgnore
|
||||
public void setRoles(Collection<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,8 @@ public interface User {
|
|||
|
||||
public Collection<String> getRoles();
|
||||
|
||||
public void setRoles(Collection<String> roles);
|
||||
|
||||
public String getGivenName();
|
||||
|
||||
public String getFamilyName();
|
||||
|
|
Loading…
Reference in New Issue