Package grails.plugin.springsecurity

Examples of grails.plugin.springsecurity.InterceptedUrl


    for (Object requestmap : ReflectionUtils.loadAllRequestmaps()) {
      String urlPattern = ReflectionUtils.getRequestmapUrl(requestmap);
      String configAttribute = ReflectionUtils.getRequestmapConfigAttribute(requestmap);
      HttpMethod method = supportsHttpMethod ? ReflectionUtils.getRequestmapHttpMethod(requestmap) : null;
      data.add(new InterceptedUrl(urlPattern, split(configAttribute), method));
    }

    return data;
  }
View Full Code Here


    for (String pattern : generatePatterns(controllerName, actionName, false)) {
      Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>();
      configAttributes.add(new ClosureConfigAttribute(newInstance(closureClass)));

      String key = pattern.toLowerCase();
      InterceptedUrl replaced = storeMapping(key, method, configAttributes);
      if (replaced != null) {
        log.warn("replaced rule for '{}' with tokens {} with tokens {}", new Object[] { key, replaced.getConfigAttributes(), configAttributes });
      }
    }
  }
View Full Code Here

  }

  protected void doStoreMapping(final String fullPattern, final HttpMethod method, final Collection<ConfigAttribute> configAttributes) {

    String key = fullPattern.toString().toLowerCase();
    InterceptedUrl replaced = storeMapping(key, method, configAttributes);
    if (replaced != null) {
      log.warn("replaced rule for '" + key + "' with tokens " + replaced.getConfigAttributes() +
          " with tokens " + configAttributes);
    }
  }
View Full Code Here

    if (annotation == null) {
      annotation = clazz.getAnnotation(grails.plugin.springsecurity.annotation.Secured.class);
      if (annotation != null) {
        Class<?> closureClass = findClosureClass((grails.plugin.springsecurity.annotation.Secured)annotation);
        if (closureClass == null) {
          classRoleMap.add(new InterceptedUrl(controllerName, getValue(annotation), getHttpMethod(annotation)));
        }
        else {
          classClosureMap.add(new InterceptedUrl(controllerName, closureClass, getHttpMethod(annotation)));
        }
      }
    }
    else {
      classRoleMap.add(new InterceptedUrl(controllerName, getValue(annotation), null));
    }

    List<InterceptedUrl> annotatedActionNames = findActionRoles(clazz);
    if (annotatedActionNames != null && !annotatedActionNames.isEmpty()) {
      actionRoleMap.put(controllerName, annotatedActionNames);
View Full Code Here

    for (Method method : clazz.getDeclaredMethods()) {
      Annotation annotation = findSecuredAnnotation(method);
      if (annotation != null) {
        Collection<String> values = getValue(annotation);
        if (!values.isEmpty()) {
          actionRoles.add(new InterceptedUrl(grailsUrlConverter.toUrlElement(method.getName()), values, getHttpMethod(annotation)));
        }
      }
    }
    return actionRoles;
  }
View Full Code Here

  protected List<InterceptedUrl> findActionClosures(final Class<?> clazz) {
    List<InterceptedUrl> actionClosures = new ArrayList<InterceptedUrl>();
    for (Method method : clazz.getDeclaredMethods()) {
      grails.plugin.springsecurity.annotation.Secured annotation = method.getAnnotation(grails.plugin.springsecurity.annotation.Secured.class);
      if (annotation != null && annotation.closure() != grails.plugin.springsecurity.annotation.Secured.class) {
        actionClosures.add(new InterceptedUrl(grailsUrlConverter.toUrlElement(method.getName()), annotation.closure(), getHttpMethod(annotation)));
      }
    }
    return actionClosures;
  }
View Full Code Here

    String key = pattern.toLowerCase();

    Collection<ConfigAttribute> configAttributes = iu.getConfigAttributes();

    InterceptedUrl replaced = storeMapping(key, method, Collections.unmodifiableCollection(configAttributes));
    if (replaced != null) {
      log.warn("replaced rule for '{}' with roles {} with roles {}", new Object[] { key, replaced.getConfigAttributes(), configAttributes });
    }
  }
View Full Code Here

  }

  protected InterceptedUrl storeMapping(final String pattern, final HttpMethod method,
      final Collection<ConfigAttribute> configAttributes) {

    InterceptedUrl existing = null;
    for (InterceptedUrl iu : compiled) {
      if (iu.getPattern().equals(pattern) && iu.getHttpMethod() == method) {
        existing = iu;
        break;
      }
    }
   
    if(existing != null) {
      compiled.remove(existing);
    }

    compiled.add(new InterceptedUrl(pattern, method, configAttributes));

    return existing;
  }
View Full Code Here

TOP

Related Classes of grails.plugin.springsecurity.InterceptedUrl

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.