本文整理汇总了Java中org.acegisecurity.AccessDeniedException类的典型用法代码示例。如果您正苦于以下问题:Java AccessDeniedException类的具体用法?Java AccessDeniedException怎么用?Java AccessDeniedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessDeniedException类属于org.acegisecurity包,在下文中一共展示了AccessDeniedException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleException
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
private void handleException(ServletRequest request, ServletResponse response,
FilterChain chain, AcegiSecurityException exception)
throws IOException, ServletException
{
if (exception instanceof AccessDeniedException) {
if (logger.isDebugEnabled()) {
logger.debug("Access is denied; delegating to AccessDeniedHandler",
exception);
}
request.setAttribute("ACCESS_DENIED", true);
accessDeniedHandler.handle(request, response, (AccessDeniedException) exception);
}
}
示例2: checkPermission
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
/**
* Check permission.
* Also prohibits the access if Jenkins has not been started yet.
* @param p Permission to be checked
* @throws AccessDeniedException Access denied
*/
private void checkPermission(Permission p) throws AccessDeniedException {
final Jenkins j = Jenkins.getInstance();
if (j == null) {
throw new AccessDeniedException("Cannot retrieve Jenkins instance. "
+ "Probably, the service is starting or shutting down");
}
j.checkPermission(p);
}
示例3: getItem
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
@Override
public T getItem(String name) throws AccessDeniedException {
for (T item : this.items) {
if (name.equals(item.getName())) {
return item;
}
}
return null;
}
示例4: decide
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config,
Object returnedObject) throws AccessDeniedException {
Iterator iter = this.providers.iterator();
Object result = returnedObject;
while (iter.hasNext()) {
AfterInvocationProvider provider = (AfterInvocationProvider) iter.next();
result = provider.decide(authentication, object, config, result);
}
return result;
}
示例5: checkPermission
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void checkPermission(@Nonnull Permission permission) throws AccessDeniedException {
getACL().checkPermission(permission);
}
示例6: checkPermission
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
@Override
public void checkPermission(@Nonnull Permission permission) throws AccessDeniedException {
getACL().checkPermission(permission);
}
示例7: checkAccessKeyPing
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public void checkAccessKeyPing(@CheckForNull String accessKey) {
if (!hasAccessKeyPing(accessKey)) {
throw new AccessDeniedException(Messages.MetricsAccessKey_invalidAccessKey(accessKey));
}
}
示例8: checkAccessKeyThreadDump
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public void checkAccessKeyThreadDump(@CheckForNull String accessKey) {
if (!hasAccessKeyThreadDump(accessKey)) {
throw new AccessDeniedException(Messages.MetricsAccessKey_invalidAccessKey(accessKey));
}
}
示例9: checkAccessKeyHealthCheck
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public void checkAccessKeyHealthCheck(@CheckForNull String accessKey) {
if (!hasAccessKeyHealthCheck(accessKey)) {
throw new AccessDeniedException(Messages.MetricsAccessKey_invalidAccessKey(accessKey));
}
}
示例10: checkAccessKeyMetrics
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public void checkAccessKeyMetrics(@CheckForNull String accessKey) {
if (!hasAccessKeyMetrics(accessKey)) {
throw new AccessDeniedException(Messages.MetricsAccessKey_invalidAccessKey(accessKey));
}
}
示例11: checkPermission
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
@Override
public void checkPermission(Permission arg0) throws AccessDeniedException {
// TODO Auto-generated method stub
}
示例12: decide
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config,
Object returnedObject) throws AccessDeniedException {
Iterator iter = config.getConfigAttributes();
securityMap = securityHelper.getPostMethodInvocationSecurityMap(methodInvocation, returnedObject);
while (iter.hasNext()) {
ConfigAttribute attr = (ConfigAttribute) iter.next();
if (this.supports(attr)) {
// Need to process the Collection for this invocation
if (returnedObject == null) {
if (logger.isDebugEnabled()) {
logger.debug("Return object is null, skipping");
}
return null;
}
// Get GrantedAuthorities from Authentication Object and Match them with the SecurityMap
GrantedAuthority[] authorities = authentication.getAuthorities();
Collection<String> grantedAuthoritiesStringCollection = new ArrayList<String>();
for(int i=0;i<authorities.length;i++){
grantedAuthoritiesStringCollection.add(authorities[i].getAuthority());
}
Collection securityRolesCollection = new ArrayList();
Set keySet = securityMap.keySet();
Iterator iterator = keySet.iterator();
while(iterator.hasNext()){
String className = (String)iterator.next();
Collection classname = (Collection) securityMap.get(className);
Iterator authoritiesIterator = classname.iterator();
while(authoritiesIterator.hasNext()){
String privilege = (String)authoritiesIterator.next();
String authority = className + "_" + privilege;
securityRolesCollection.add(authority);
}
}
boolean accessDenied = false;
Iterator securityRolesCollectionIterator = securityRolesCollection.iterator();
while(securityRolesCollectionIterator.hasNext()){
String string = (String) securityRolesCollectionIterator.next();
if(!grantedAuthoritiesStringCollection.contains(string)){
accessDenied = true;
}
}
if(accessDenied){
throw new AccessDeniedException("User does not have access to some or all of returned object.");
}
return returnedObject;
}
}
return returnedObject;
}
示例13: getService
import org.acegisecurity.AccessDeniedException; //导入依赖的package包/类
/**
* Fetch a service <em>module</em> identified by its class, or interface,
* identifier.
*
* @param module
* @return an IService implementation, or NULL if none found with the given
* class name, interface name or identifier.
*
* @throws AccessDeniedException in case the current user is not allowed
* to access the resource.
*/
IService getService(Class<? extends IService> moudule) throws AccessDeniedException;