Skip to content

Commit

Permalink
v3.0.1 (#125)
Browse files Browse the repository at this point in the history
* basic auth fix

* sparql query check

* refactor fix

* changes next release

* en translation

* updated version

* removed quartz env property and fixed orion test bearer

* Updated Log4j2 to 2.15.0

* change log

* docker-compose updates

* Cookie secured and NGSI Connector subscription url management

* updated docker-compose

* updated docker-compose

* updated version

* fix catalogue pagination

* fix

* Updated CHANGELOG.txt

* fix alferov/angular-file-saver#48 (comment)

* keycloak realm roles

* Bumped version to 3.0.1

* Bumped mysql-connector-java #27
  • Loading branch information
robcalla authored Jun 22, 2022
1 parent 7e69980 commit 3437ade
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.0.1
- Fix: Management of Keycloak's realm roles
- Dependabot Fix: Bumped mysql-connector-java to version 8.0.28

v3.0.0
- New Feature: Native support of NGSI-LD Catalogues providing DCAT-AP Data models (https://github.com/smart-data-models/dataModel.DCAT-AP)
- New Feature: Integration of the functionality to map the DCAT-AP metadata of the federated catalogues in a Context Broker
Expand Down
2 changes: 1 addition & 1 deletion Idra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
<version>8.0.28</version>
</dependency>
<!-- https://mvnrepository.com/artifact/au.com.bytecode/opencsv -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
import it.eng.idra.authentication.keycloak.model.KeycloakUser;
import it.eng.idra.utils.PropertyManager;
import java.net.URI;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;

// TODO: Auto-generated Javadoc
/**
Expand Down Expand Up @@ -155,7 +158,18 @@ public Boolean validateToken(Object tokenObj) throws Exception {
*/
public void validateAdminRole(KeycloakUser user) throws Exception {

Set<String> roles = user.getRoles();
List<String> roles = new ArrayList<String>();

if (CollectionUtils.isNotEmpty(user.getRealmAccess().getRoles())) {
roles.addAll(user.getRealmAccess().getRoles().stream()
.map(x -> x.toUpperCase()).collect(Collectors.toList()));
}

if (CollectionUtils.isNotEmpty(user.getRoles())) {
roles.addAll(user.getRoles().stream()
.map(x -> x.toUpperCase()).collect(Collectors.toList()));
}

if (roles != null && !roles.isEmpty() && roles
.contains(PropertyManager.getProperty(IdmProperty.IDM_ADMIN_ROLE_NAME).toUpperCase())) {
// OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class KeycloakUser {

/** The roles. */
private Set<String> roles;

/** Realm Roles. */
@SerializedName(value = "realm_access")
private RealmAccess realmAccess;

/** The name. */
private String name;
Expand Down Expand Up @@ -227,6 +231,25 @@ public String getEmail() {
public void setEmail(String email) {
this.email = email;
}

/**
* Gets the realmAccess.
*
* @return the realmAccess
*/
public RealmAccess getRealmAccess() {
return realmAccess;
}

/**
* Sets the realmAccess.
*
* @param realmAccess the new RealmAccess
*/
public void setRealmAccess(RealmAccess realmAccess) {
this.realmAccess = realmAccess;
}


/*
* (non-Javadoc)
Expand All @@ -240,4 +263,21 @@ public String toString() {
+ "given_name=" + givenName + ", family_name=" + familyName + ", email=" + email + "]";
}

/**
* RealmAccess class.
*
*/
public class RealmAccess {
private Set<String> roles;

public Set<String> getRoles() {
return roles;
}

public void setRoles(Set<String> roles) {
this.roles = roles;
}
}


}
4 changes: 2 additions & 2 deletions Idra/src/main/resources/configuration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# along with this program. If not, see http://www.gnu.org/licenses/.
#-------------------------------------------------------------------------------
################# PLATFORM API ###################################
idra.version=3.0.0
idra.release.timestamp=2022-06-06T15:30:00Z
idra.version=3.0.1
idra.release.timestamp=2022-06-22T13:00:00Z

################# PERSISTENCE MANAGER CONFIGURATION ##############
#&rewriteBatchedStatements\=true
Expand Down

0 comments on commit 3437ade

Please sign in to comment.