Package com.khs.sherpa.exception

Examples of com.khs.sherpa.exception.SherpaPermissionExcpetion


      endpoint = target.getAnnotation(Endpoint.class);
    }
   
    // make sure its authenicated
    if(endpoint.authenticated() && !service.isActive(userid, token).equals(SessionStatus.AUTHENTICATED)) {
      throw new SherpaPermissionExcpetion("User status [" + service.isActive(userid, token) + "]", service.isActive(userid, token).toString());
    }
  }
View Full Code Here


    } catch (NoSuchManagedBeanExcpetion e) {
      throw new SherpaRuntimeException(e);
    }

    if(method.isAnnotationPresent(DenyAll.class)) {
      throw new SherpaPermissionExcpetion("method ["+method.getName()+"] in class ["+method.getDeclaringClass().getCanonicalName()+"] has `@DenyAll` annotation", "DENY_ALL");
    }
   
    if(method.isAnnotationPresent(RolesAllowed.class)) {
      boolean fail = true;
      for(String role: method.getAnnotation(RolesAllowed.class).value()) {
        if(service.hasRole(userid, token, role)) {
          fail = false;
        }
      }
      if(fail) {
        throw new SherpaPermissionExcpetion("method ["+method.getName()+"] in class ["+method.getDeclaringClass().getCanonicalName()+"] has `@RolesAllowed` annotation", "DENY_ROLE" );
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.khs.sherpa.exception.SherpaPermissionExcpetion

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.