// Path: examples/spring-security/src/main/java/com/coverity/security/pie/example/model/Role.java
// public enum Role {
//     GUEST, USER, ADMIN, SYSTEM;
// }


import java.util.Collection;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import com.coverity.security.pie.example.model.Role;
package com.coverity.security.pie.plugin.springsecurity;




public class PieAccessDecisionManager implements AccessDecisionManager {

    private final SpringSecurityPolicyEnforcer policyEnforcer;
    
    public PieAccessDecisionManager(SpringSecurityPolicyEnforcer policyEnforcer) {
        this.policyEnforcer = policyEnforcer;
    }
    
    @Override
    public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes)
            throws AccessDeniedException, InsufficientAuthenticationException {
        
        if (!(object instanceof MethodInvocation)) {
            throw new IllegalStateException("Only operates on methods.");
        }
        MethodInvocation methodInvocation = (MethodInvocation)object;
        
// Path: examples/spring-security/src/main/java/com/coverity/security/pie/example/model/Role.java
// public enum Role {
//     GUEST, USER, ADMIN, SYSTEM;
// }


// Path: examples/spring-security/src/main/java/com/coverity/security/pie/plugin/springsecurity/PieAccessDecisionManager.java
import java.util.Collection;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import com.coverity.security.pie.example.model.Role;

package com.coverity.security.pie.plugin.springsecurity;




public class PieAccessDecisionManager implements AccessDecisionManager {

    private final SpringSecurityPolicyEnforcer policyEnforcer;
    
    public PieAccessDecisionManager(SpringSecurityPolicyEnforcer policyEnforcer) {
        this.policyEnforcer = policyEnforcer;
    }
    
    @Override
    public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes)
            throws AccessDeniedException, InsufficientAuthenticationException {
        
        if (!(object instanceof MethodInvocation)) {
            throw new IllegalStateException("Only operates on methods.");
        }
        MethodInvocation methodInvocation = (MethodInvocation)object;
        
        Role role = null;