[keycloak-user] getRoleMappings - please I need a help

JOSE INACIO DA SILVA JUNIOR inacio-silva at prodesan.com.br
Mon Jan 29 14:47:09 EST 2018


Hi,

I'm changing PropertyFileUserStorageProvider example. And I need to override the method: Set<RoleModel> getRoleMappingsInternal(); of the class

AbstractUserAdapterFederatedStorage.class in order to retrive external roles based on a legacy system.

How can I do that?

I've tried:

protected Set<RoleModel> getRoleMappingsInternal() {
           	
         Set<RoleModel> roles = new HashSet<>();
         RoleModel role = new MyRoleAdapter(realm,"role1","role1","role1 description", false);
         roles.add(role);
         return roles;

}

The code of MyRoleAdapter:


public class MyRoleAdapter implements RoleModel{
	private String id;
	private String name;
	private String description;
	private RealmModel container;
	private boolean isClientRole;
	
	public RoleProdesanAdapter(RealmModel container, String id, String name, String description, boolean isClientRole) {
		this.id = id;
		this.name = name;
		this.description = description;
		this.container = container;
		this.isClientRole = isClientRole;
	}

        // getters
}


Please help me. I've tried a lot but without success!


Thanks in advance!
Inácio






More information about the keycloak-user mailing list