All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payneteasy.superfly.security.mapbuilder.SeparateActionsMapBuilder Maven / Gradle / Ivy

Go to download

Module for Spring Security which enables application to use Superfly authentication/authorization declaratively through Spring Security

There is a newer version: 1.7-32
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy