com.payneteasy.superfly.security.mapbuilder.SeparateActionsMapBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of superfly-spring-security Show documentation
Show all versions of superfly-spring-security Show documentation
Module for Spring Security which enables application to use Superfly authentication/authorization declaratively through Spring Security
package com.payneteasy.superfly.security.mapbuilder;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Required;
import com.payneteasy.superfly.api.SSOAction;
import com.payneteasy.superfly.api.SSORole;
/**
* {@link ActionsMapBuilder} implementation in which it's possible to specify
* actions for each role separately.
*
* @author Roman Puchkovskiy
*/
public class SeparateActionsMapBuilder implements ActionsMapBuilder {
private Map roleNamesToActionsSources;
@Required
public void setRoleNamesToActionsSources(
Map roleNamesToActionsSources) {
this.roleNamesToActionsSources = roleNamesToActionsSources;
}
public Map build() throws Exception {
Map map = new HashMap();
for (Entry entry : roleNamesToActionsSources.entrySet()) {
map.put(new SSORole(entry.getKey()), entry.getValue().getActions());
}
return map;
}
}