Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add missing MASTER realm check to TokenVerifierImpl (#2994)

Rich Turner3dbc182134c5
diff --git a/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java b/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java
index 0fccc0f15..0fece0ec2 100644
--- a/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java
+++ b/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java
@@ -132,7 +132,7 @@ public class TokenVerifierImpl implements TokenVerifier {
// Only allow super users to cross realms
String authRealm = principal.getRealm();
if (!Objects.equals(authRealm, realm)) {
- if (!principal.hasRealmRole(Constants.SUPER_USER_REALM_ROLE)) {
+ if (!Constants.MASTER_REALM.equals(authRealm) || !principal.hasRealmRole(Constants.SUPER_USER_REALM_ROLE)) {
throw new AuthenticationException("Invalid token realm");
}
}