Package org.springframework.security.access.annotation

Examples of org.springframework.security.access.annotation.Secured


        for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(Secured.class)) {
            transformMethod(plasticClass, method);
        }

        // Secure pages
        Secured annotation = plasticClass.getAnnotation(Secured.class);
        if (annotation != null) {
          model.addRenderPhase(BeginRender.class);
            model.addRenderPhase(CleanupRender.class);
            transformPage(plasticClass, annotation);
        }
View Full Code Here


        final PlasticField tokenFieldInstance = plasticClass.introduceField(InterceptorStatusToken.class,"_$token");
        final FieldHandle tokenFieldHandle = tokenFieldInstance.getHandle();
       
       
        // Attribute definition
        final Secured annotation = method.getAnnotation(Secured.class);
        //final String configField = createConfigAttributeDefinitionField(transformation, annotation);
        final ConfigAttributeHolder confAttrHolder = createConfigAttributeDefinitionField(plasticClass, annotation);

        final SecurityChecker secChecker = this.securityChecker;
        MethodAdvice securedMethodAdvice = new MethodAdvice() {
View Full Code Here

        this.applicationContext = applicationContext;
    }

    @Override
    public boolean isAccessGranted(String beanName, UI ui) {
        Secured viewSecured = applicationContext.findAnnotationOnBean(beanName, Secured.class);
        return !(viewSecured != null && !security.hasAnyAuthority(viewSecured.value()));
    }
View Full Code Here

     *
     * @param securedObject the secured object, must not be {@code null} and must have the {@link org.springframework.security.access.annotation.Secured} annotation.
     * @return true if the current user is authorized, false if not.
     */
    public boolean hasAccessToSecuredObject(Object securedObject) {
        final Secured secured = AopUtils.getTargetClass(securedObject).getAnnotation(Secured.class);
        Assert.notNull(secured, "securedObject did not have @Secured annotation");
        return hasAccessToObject(securedObject, secured.value());
    }
View Full Code Here

     * @see #hasAccessToSecuredObject(Object)
     */
    public boolean hasAccessToSecuredMethod(Object securedObject, String methodName, Class<?>... methodParameterTypes) {
        try {
            final Method method = securedObject.getClass().getMethod(methodName, methodParameterTypes);
            final Secured secured = AnnotationUtils.findAnnotation(method, Secured.class);
            Assert.notNull(secured, "securedObject did not have @Secured annotation");
            return hasAccessToObject(securedObject, secured.value());
        } catch (NoSuchMethodException ex) {
            throw new IllegalArgumentException("Method " + methodName + " does not exist", ex);
        }
    }
View Full Code Here

   */
  private void isAllowed(Method mtd) {
    final Annotation[] annotations = mtd.getAnnotations();
    for (final Annotation annotation : annotations) {
      if (annotation instanceof Secured) {
        final Secured secured = (Secured) annotation;
        for (final String rightName : secured.value()) {
          if (!this.userWorkspace.isAllowed(rightName)) {
            throw new SecurityException("Call of this method is not allowed! Missing right: \n\n" + "needed RightName: " + rightName + "\n\n" + "Method: " + mtd);
          }
        }
        return;
View Full Code Here

public class ComponentMetadataSource implements SecurityMetadataSource {

    @Override
    public Collection<ConfigAttribute> getAttributes(Object componentClass)
            throws IllegalArgumentException {
        Secured secured = (Secured) ((Class)componentClass).getAnnotation(Secured.class);
        if(secured != null) {
            return SecurityConfig.createList(secured.value());
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.access.annotation.Secured

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.