Skip to content

Commit 3d8dcd1

Browse files
committed
Merge branch 'develop' of github.com:OpenIotOrg/openiot into develop
2 parents e2d6336 + 91c8305 commit 3d8dcd1

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

modules/lsm-light/lsm-light.server/src/main/java/org/openiot/lsm/http/SecurityInitializer.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private List<LSMRegisteredServiceImpl> createDefaultServices() {
226226
defaultService.setEvaluationOrder(0);
227227
defaultService.setIgnoreAttributes(true);
228228
defaultService.setName("Service Manager");
229-
String casPrefix = props.getProperty(CAS_PREFIX, "https://localhost:8443/openiot-cas");
229+
String casPrefix = props.getProperty(CAS_PREFIX, "https://localhost:8443/openiot-cas").trim();
230230
if (casPrefix.endsWith("/") && casPrefix.length() > 1)
231231
casPrefix = casPrefix.substring(0, casPrefix.length() - 1);
232232
defaultService.setServiceId(casPrefix + "/services/j_acegi_cas_security_check");
@@ -266,7 +266,7 @@ private List<LSMRegisteredServiceImpl> createDefaultServices() {
266266
userManagementService.setEvaluationOrder(0);
267267
userManagementService.setIgnoreAttributes(false);
268268
userManagementService.setName(props.getProperty(SECURITY_MANAGEMENT_KEY, "openiot-security-manager-app"));
269-
String mgmtAppPrefix = props.getProperty(MGMT_PREFIX, "http://localhost:8080/security.management");
269+
String mgmtAppPrefix = props.getProperty(MGMT_PREFIX, "http://localhost:8080/security.management").trim();
270270
if (mgmtAppPrefix.endsWith("/") && mgmtAppPrefix.length() > 1)
271271
mgmtAppPrefix = mgmtAppPrefix.substring(0, mgmtAppPrefix.length() - 1);
272272
userManagementService.setServiceId(mgmtAppPrefix + "/callback?client_name=CasOAuthWrapperClient");
@@ -325,7 +325,7 @@ private List<LSMRegisteredServiceImpl> createDefaultServices() {
325325
reqDefService.setEvaluationOrder(0);
326326
reqDefService.setIgnoreAttributes(false);
327327
reqDefService.setName(props.getProperty(REQ_DEF_KEY, "requestDefinitionUI"));
328-
String reqDefPrefix = props.getProperty(REQ_DEF_PREFIX, "http://localhost:8080/ui.requestDefinition");
328+
String reqDefPrefix = props.getProperty(REQ_DEF_PREFIX, "http://localhost:8080/ui.requestDefinition").trim();
329329
if (reqDefPrefix.endsWith("/") && reqDefPrefix.length() > 1)
330330
reqDefPrefix = reqDefPrefix.substring(0, reqDefPrefix.length() - 1);
331331
reqDefService.setServiceId(reqDefPrefix + "/callback?client_name=CasOAuthWrapperClient");
@@ -342,7 +342,7 @@ private List<LSMRegisteredServiceImpl> createDefaultServices() {
342342
reqPresService.setEvaluationOrder(0);
343343
reqPresService.setIgnoreAttributes(false);
344344
reqPresService.setName(props.getProperty(REQ_PRES_KEY, "requestPresentationUI"));
345-
String reqPresPrefix = props.getProperty(REQ_PRES_PREFIX, "http://localhost:8080/ui.requestPresentation");
345+
String reqPresPrefix = props.getProperty(REQ_PRES_PREFIX, "http://localhost:8080/ui.requestPresentation").trim();
346346
if (reqPresPrefix.endsWith("/") && reqPresPrefix.length() > 1)
347347
reqPresPrefix = reqPresPrefix.substring(0, reqPresPrefix.length() - 1);
348348
reqPresService.setServiceId(reqPresPrefix + "/callback?client_name=CasOAuthWrapperClient");
@@ -359,7 +359,7 @@ private List<LSMRegisteredServiceImpl> createDefaultServices() {
359359
schemaEditorService.setEvaluationOrder(0);
360360
schemaEditorService.setIgnoreAttributes(false);
361361
schemaEditorService.setName(props.getProperty(SCHEMA_EDITOR_KEY, "schemaEditor"));
362-
String schemaEditorPrefix = props.getProperty(SCHEMA_EDITOR_PREFIX, "http://localhost:8080/sensorschema");
362+
String schemaEditorPrefix = props.getProperty(SCHEMA_EDITOR_PREFIX, "http://localhost:8080/sensorschema").trim();
363363
if (schemaEditorPrefix.endsWith("/") && schemaEditorPrefix.length() > 1)
364364
schemaEditorPrefix = schemaEditorPrefix.substring(0, schemaEditorPrefix.length() - 1);
365365
schemaEditorService.setServiceId(schemaEditorPrefix + "/callback?client_name=CasOAuthWrapperClient");

modules/lsm-light/lsm-light.server/src/main/java/org/openiot/lsm/utils/SecurityUtil.java

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public static boolean hasPermission(String perm, ServletContext context, String
102102
public static synchronized OAuthorizationCredentials login(ServletContext context) {
103103
OAuthorizationCredentials credentials = (OAuthorizationCredentials) context.getAttribute(CREDENTIALS);
104104
if (credentials == null) {
105+
//log out the user if necessary
106+
acUtil.logout();
105107
logger.debug("Logging into CAS by username {}", username);
106108
credentials = acUtil.login(username, password);
107109
logger.debug("Credentials obtained after logging in is {}", credentials);

modules/scheduler/scheduler.core/src/main/java/org/openiot/scheduler/core/utils/SecurityUtil.java

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public static synchronized OAuthorizationCredentials login() {
103103
if (credentials != null) {
104104
logger.debug("Credentials found in context. Aborting login process.");
105105
} else {
106+
//log out the user if necessary
107+
acUtil.logout();
106108
logger.debug("Logging into CAS by username {}", username);
107109
OAuthorizationCredentials creds = acUtil.login(username, password);
108110
logger.debug("Credentials obtained after logging in is {}", creds);

modules/sdum/sdum.core/src/main/java/org/openiot/sdum/core/utils/SecurityUtil.java

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public static synchronized OAuthorizationCredentials login() {
102102
if (credentials != null) {
103103
logger.debug("Credentials found in context. Aborting login process.");
104104
} else {
105+
//log out the user if necessary
106+
acUtil.logout();
105107
logger.debug("Logging into CAS by username {}", username);
106108
OAuthorizationCredentials creds = acUtil.login(username, password);
107109
logger.debug("Credentials obtained after logging in is {}", creds);

0 commit comments

Comments
 (0)