List of usage examples for org.springframework.security.access AccessDecisionVoter ACCESS_DENIED
int ACCESS_DENIED
To view the source code for org.springframework.security.access AccessDecisionVoter ACCESS_DENIED.
Click Source Link
From source file:org.duracloud.account.security.vote.AccountAccessDecisionVoterTest.java
@Test public void testScopeSelfAcctFail() throws DBNotFoundException { Role userRole = Role.ROLE_USER; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeSelfAcct(userRole, expectedDecision); }
From source file:org.duracloud.account.security.vote.AccountManagerAccessDecisionVoterTest.java
@Test public void testVoteScopeAnyFail() { Role userRole = Role.ROLE_ADMIN; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeAny(userRole, expectedDecision); }
From source file:org.duracloud.account.security.vote.UserAccessDecisionVoterTest.java
@Test public void testVoteScopeAnyFail() { Role userRole = Role.ROLE_INIT; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeAny(userRole, expectedDecision); }
From source file:grails.plugin.springsecurity.access.vote.AuthenticatedVetoableDecisionManager.java
/** * Allow any {@link AuthenticatedVoter} to veto. If any voter denies, * throw an exception; if any grant, return <code>true</code>; * otherwise return <code>false</code> if all abstain. *///w ww. j a va 2 s. c o m @SuppressWarnings({ "rawtypes", "unchecked" }) protected boolean checkAuthenticatedVoters(final Authentication authentication, final Object object, final Collection<ConfigAttribute> configAttributes) { boolean grant = false; for (AccessDecisionVoter voter : getDecisionVoters()) { if (voter instanceof AuthenticatedVoter) { int result = voter.vote(authentication, object, configAttributes); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: grant = true; break; case AccessDecisionVoter.ACCESS_DENIED: deny(); break; default: // abstain break; } } } return grant; }
From source file:org.codehaus.groovy.grails.plugins.springsecurity.AuthenticatedVetoableDecisionManager.java
/** * Allow any {@link AuthenticatedVoter} to veto. If any voter denies, * throw an exception; if any grant, return <code>true</code>; * otherwise return <code>false</code> if all abstain. *//*from www . j a v a 2s.c om*/ private boolean checkAuthenticatedVoters(final Authentication authentication, final Object object, final Collection<ConfigAttribute> configAttributes) { boolean grant = false; for (AccessDecisionVoter voter : getDecisionVoters()) { if (voter instanceof AuthenticatedVoter) { int result = voter.vote(authentication, object, configAttributes); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: grant = true; break; case AccessDecisionVoter.ACCESS_DENIED: deny(); break; default: // abstain break; } } } return grant; }
From source file:org.duracloud.account.security.vote.AccountManagerAccessDecisionVoterTest.java
@Test public void testScopeSelfAcctFail() throws DBNotFoundException { Role userRole = Role.ROLE_ADMIN; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeSelfAcct(userRole, expectedDecision); }
From source file:org.duracloud.account.security.vote.UserAccessDecisionVoterTest.java
@Test public void testScopeSelfAcctPeerFail() throws DBNotFoundException { Role otherUserRole = Role.ROLE_USER; int otherAcctId = 6; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeSelfAcctPeer(otherUserRole, otherAcctId, expectedDecision); }
From source file:grails.plugin.springsecurity.access.vote.AuthenticatedVetoableDecisionManager.java
/** * Check the other (non-{@link AuthenticatedVoter}) voters. If any voter grants, * return true. If any voter denies, throw exception. Otherwise return <code>false</code> * to indicate that all abstained./*from w w w.j a v a 2s . c o m*/ */ @SuppressWarnings({ "rawtypes", "unchecked" }) protected boolean checkOtherVoters(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) { int denyCount = 0; for (AccessDecisionVoter voter : getDecisionVoters()) { if (voter instanceof AuthenticatedVoter) { continue; } int result = voter.vote(authentication, object, configAttributes); switch (result) { case AccessDecisionVoter.ACCESS_GRANTED: return true; case AccessDecisionVoter.ACCESS_DENIED: denyCount++; break; default: // abstain break; } } if (denyCount > 0) { deny(); } // all abstain return false; }
From source file:com.qpark.eip.core.spring.statistics.impl.SysUserStatisticsChannelInvocationListener.java
/** * @see com.qpark.eip.core.spring.security.EipChannelInvocationListener#channelInvocation(org.springframework.integration.security.channel.ChannelInvocation, * java.lang.String, int)/*ww w . java2s. c o m*/ */ @Override public void channelInvocation(final ChannelInvocation channel, final String userName, final int result) { String channelName = EipRoleVoter.getChannelName(channel); String serviceName = EipRoleVoter.getServiceName(channel, ".service.", ".msg."); String operationName = EipRoleVoter.getOperationName(channel); if (serviceName != null && serviceName.trim().length() > 0 && operationName != null && operationName.trim().length() > 0) { SystemUserLogType log = new SystemUserLogType(); log.setUserName(userName); log.setServiceName(serviceName); log.setOperationName(operationName); log.setLogDateItem(SysUserStatisticsChannelInvocationListener.getRequestDate().getTime()); log.setContext(this.contextNameProvider.getContextName()); log.setVersion(this.contextNameProvider.getContextVersion()); if (result == AccessDecisionVoter.ACCESS_DENIED) { log.setRequestsDenied(1); } else if (channelName.contains("WsChannelRequest")) { log.setRequestsGranted(1); } else if (channelName.contains("WsChannelResponse") && this.messageContainsSoapFault(channel)) { log.setResponseFaults(1); } if (this.logger.isTraceEnabled()) { this.logger.trace("{},{},{},{},{},{},{},{}", log.getContext(), log.getServiceName(), log.getOperationName(), log.getUserName(), log.getRequestsDenied(), log.getRequestsGranted(), log.getResponseFaults(), log.getLogDateItem()); } this.submitSystemUserLogType(log, EipRoleVoter.getResultString(result)); } }
From source file:org.duracloud.account.security.vote.UserAccessDecisionVoterTest.java
@Test public void testScopeSelfAcctPeerFailRole() throws DBNotFoundException { Role otherUserRole = Role.ROLE_OWNER; int expectedDecision = AccessDecisionVoter.ACCESS_DENIED; doTestScopeSelfAcctPeer(otherUserRole, expectedDecision); }