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