Commit f02890d1 authored by Simon Reis's avatar Simon Reis
Browse files

SI-2473-Acknowledge-Client-Roles

parent 2a40d5ca
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ public class BackendConfigTest {
        BackendConfig bc = BackendConfig.getInstance();
        assertEquals( 3600000, (int)bc.getInternalSessionLengthMillis() );
        assertEquals( 300 , (int)bc.getReloadUsersInSec());
        assertEquals( "http://entjava002:8080/", bc.getAuthServerUrl() );
        assertEquals( "elogbook", bc.getKeycloakRealm());
        assertEquals( "http://entopkon:8080/", bc.getAuthServerUrl() );
        assertEquals( "Elogbook", bc.getKeycloakRealm());
        assertEquals( "elogbook-backend", bc.getKeycloakClient());
        assertEquals( "admin", bc.getKeycloakAdmin() );
        assertEquals( "admin", bc.getKeycloakPW() );
+11 −2
Original line number Diff line number Diff line
@@ -94,8 +94,8 @@ public class JwtHelperTest extends ResourceLoaderBase {
    }

    @Test
    public void testGetRolesListFromJson_testKeyCloakRoles_onlyRealmRole() throws PortalInternalServerError {
        String jsonKeyCloakRoles = super.loadStringFromResource("testKeyCloakRoles_onlyRealmRole.json");
    public void testGetRolesListFromJson_testKeyCloakRoles_onlyClientRole() throws PortalInternalServerError {
        String jsonKeyCloakRoles = super.loadStringFromResource("testKeyCloakRoles_onlyClientRole.json");
        List<KeyCloakRole> keyCloakRolesList = JwtHelper.getRolesListFromJson(jsonKeyCloakRoles);

        assertEquals("view-profile", keyCloakRolesList.get(0).getName());
@@ -103,5 +103,14 @@ public class JwtHelperTest extends ResourceLoaderBase {
        assertEquals(2, keyCloakRolesList.size());
    }

    @Test
    public void testGetRolesListFromJson_testKeyCloakRoles_sameClientRealmRole() throws PortalInternalServerError {
        String jsonKeyCloakRoles = super.loadStringFromResource("testKeyCloakRoles_sameClientRealmRole.json");
        List<KeyCloakRole> keyCloakRolesList = JwtHelper.getRolesListFromJson(jsonKeyCloakRoles);

        assertEquals("elogbook-access", keyCloakRolesList.get(0).getName());
        assertEquals(4, keyCloakRolesList.size());
    }


}
+47 −0
Original line number Diff line number Diff line
{
  "realmMappings": [
    {
      "id": "384e7a68-8e70-41aa-bbbd-1a0ffb293335",
      "name": "elogbook-access",
      "scopeParamRequired": false,
      "composite": false,
      "clientRole": false,
      "containerId": "elogbook"
    },
    {
      "id": "6b8d2da8-220c-4f83-8e15-889004e66359",
      "name": "elogbook-normaluser",
      "description": "Darf vieles, aber nicht alles",
      "scopeParamRequired": false,
      "composite": false,
      "clientRole": false,
      "containerId": "elogbook"
    }
  ],
  "clientMappings": {
    "elogbook-backend": {
      "id": "ab5b5dd0-e943-4cef-bb86-5f17031ca6ed",
      "client": "elogbook-backend",
      "mappings": [
        {
          "id": "bfcf9034-7921-4200-ad2a-bf3f9c0d3f38",
          "name": "elogbook-access",
          "description": "${role_view-profile}",
          "scopeParamRequired": false,
          "composite": false,
          "clientRole": true,
          "containerId": "ab5b5dd0-e943-4cef-bb86-5f17031ca6ed"
        },
        {
          "id": "0706bea7-d53b-4075-a4ab-d0b175cd660f",
          "name": "manage-account",
          "description": "${role_manage-account}",
          "scopeParamRequired": false,
          "composite": true,
          "clientRole": true,
          "containerId": "ab5b5dd0-e943-4cef-bb86-5f17031ca6ed"
        }
      ]
    }
  }
}
 No newline at end of file