Package org.springframework.security.access

Examples of org.springframework.security.access.AccessDeniedException


        User loginUser = UserUtil.getLoginUser();
        Integer value = (Integer) BeanUtil.getFieldValue(loginUser, fieldName);
        if (value != Role.ALL_OR_ENABLED) {
            ResourceBundle rb = CommonUtil.getResourceBundle();
            String errorMessage = rb.getString("access.nopermission");
            throw new AccessDeniedException(errorMessage);
        }
    }
View Full Code Here


            if (loginUser.getId().intValue() != entity.getOwner().getId()
                    .intValue()) {
                ResourceBundle rb = CommonUtil.getResourceBundle();
                String errorMessage = rb
                        .getString("access.nopermission.record");
                throw new AccessDeniedException(errorMessage);
            }
        }
    }
View Full Code Here

            throws AccessDeniedException, InsufficientAuthenticationException {

        try {
            if (authentication.getPrincipal() instanceof String
                    && "anonymousUser".equals(authentication.getPrincipal())) {
                throw new AccessDeniedException(" no permission access!");
            }
            return;
        } catch (Exception e) {
            throw new AccessDeniedException("Role check fails.");
        }
    }
View Full Code Here

        Authentication user = user();
        if (user == null || user.getAuthorities().size() == 0)
            return new InsufficientAuthenticationException("Cannot access "
                    + resourceName + " as anonymous");
        else
            return new AccessDeniedException("Cannot access "
                    + resourceName + " with the current privileges");
    }
View Full Code Here

        // is an unauthorized direct resource access, complain
        Authentication user = user();
        if (user == null || user.getAuthorities().size() == 0)
            return new InsufficientAuthenticationException("Operation unallowed with the current privileges");
        else
            return new AccessDeniedException("Operation unallowed with the current privileges");
    }
View Full Code Here

                        break;
                    }
                }
               
                if(!roleFound) {
                    throw new AccessDeniedException("Cannot access "
                            + service + "." + method + " with the current privileges");
                }
            }
        }
       
View Full Code Here

        if(needPermission.equals(ga.getAuthority())){
          return;
        }
      }
    }
    throw new AccessDeniedException("没有权限!");
  }
View Full Code Here

    // all abstain
    return false;
  }

  protected void deny() {
    throw new AccessDeniedException(messages.getMessage(
        "AbstractAccessDecisionManager.accessDenied",
        "Access is denied"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.access.AccessDeniedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.