KEYCLOAK-43 ApplicationAdapter.addScope doesn't add scope into IDM

This commit is contained in:
mposolda 2013-08-16 13:55:57 +02:00
parent d97a615c81
commit 0b9a59950a
2 changed files with 8 additions and 0 deletions

View file

@ -154,6 +154,7 @@ public class ApplicationAdapter implements ApplicationModel {
ScopeRelationship scope = new ScopeRelationship();
scope.setClient(((UserAdapter)agent).getUser());
scope.setScope(((RoleAdapter)role).getRole());
getRelationshipManager().add(scope);
}
@Override

View file

@ -87,6 +87,13 @@ public class ImportTest {
List<RealmModel> realms = identitySession.getRealms(admin);
Assert.assertEquals(1, realms.size());
// Test scope relationship
ApplicationModel application = realm.getResourceNameMap().get("Application");
UserModel oauthClient = realm.getUser("oauthclient");
Assert.assertNotNull(application);
Assert.assertNotNull(oauthClient);
Set<String> appScopes = application.getScope(oauthClient);
Assert.assertTrue(appScopes.contains("user"));
}
@Test