Java 类javax.servlet.annotation.ServletSecurity.EmptyRoleSemantic 实例源码

项目:packagedrone    文件:UserController.java   
@RequestMapping ( value = "/{userId}/view", method = RequestMethod.GET )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView viewUser ( @PathVariable ( "userId" ) final String userId, final HttpServletRequest request )
{
    final boolean you = isYou ( userId, request );

    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final DatabaseUserInformation user = this.storage.getUserDetails ( userId );

    if ( user == null || user.getDetails ( DatabaseDetails.class ) == null )
    {
        return CommonController.createNotFound ( "user", userId );
    }

    final ModelAndView model = new ModelAndView ( "user/view" );
    model.put ( "user", user );
    model.put ( "you", you );
    return model;
}
项目:package-drone    文件:UserController.java   
@RequestMapping ( value = "/{userId}/view", method = RequestMethod.GET )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView viewUser ( @PathVariable ( "userId" ) final String userId, final HttpServletRequest request)
{
    final boolean you = isYou ( userId, request );

    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final DatabaseUserInformation user = this.storage.getUserDetails ( userId );

    if ( user == null || user.getDetails ( DatabaseDetails.class ) == null )
    {
        return CommonController.createNotFound ( "user", userId );
    }

    final ModelAndView model = new ModelAndView ( "user/view" );
    model.put ( "user", user );
    model.put ( "you", you );
    return model;
}
项目:tomcat7    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:tomcat7    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:tomcat7    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:tomcat7    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:apache-tomcat-7.0.73-with-comment    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:apache-tomcat-7.0.73-with-comment    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:apache-tomcat-7.0.73-with-comment    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:lazycat    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(HttpConstraintElement element, String urlPattern,
        boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() != ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:lazycat    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:lazycat    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException
 *             if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic, TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 && EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString("httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:beyondj    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:packagedrone    文件:HttpContraintControllerInterceptor.java   
public static boolean isAllowed ( final HttpConstraint constraint, final HttpServletRequest request )
{
    final EmptyRoleSemantic empty = constraint.value ();
    final String[] allowedRoles = constraint.rolesAllowed ();

    if ( allowedRoles == null || allowedRoles.length <= 0 )
    {
        // no roles
        if ( EmptyRoleSemantic.PERMIT.equals ( empty ) )
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        // check all roles .. one is ok

        for ( final String role : allowedRoles )
        {
            if ( request.isUserInRole ( role ) )
            {
                return true;
            }
        }

        // we ran out of options

        return false;
    }
}
项目:packagedrone    文件:UserController.java   
@RequestMapping ( "/{userId}/newPassword" )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView changePassword ( @PathVariable ( "userId" ) final String userId, final HttpServletRequest request )
{
    final Map<String, Object> model = new HashMap<> ();

    final boolean you = isYou ( userId, request );
    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final DatabaseUserInformation user = this.storage.getUserDetails ( userId );
    if ( user == null )
    {
        return CommonController.createNotFound ( "user", userId );
    }

    final DatabaseDetails details = user.getDetails ( DatabaseDetails.class );

    if ( details == null )
    {
        return CommonController.createNotFound ( "details", userId );
    }

    final NewPassword data = new NewPassword ();
    data.setEmail ( details.getEmail () );

    model.put ( "you", you );
    model.put ( "command", data );

    return new ModelAndView ( "user/newPassword", model );
}
项目:packagedrone    文件:UserController.java   
@RequestMapping ( value = "/{userId}/newPassword", method = RequestMethod.POST )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView changePasswordPost ( @PathVariable ( "userId" ) final String userId, @Valid @FormData ( "command" ) final NewPassword data, final BindingResult result, final HttpServletRequest request )
{
    final boolean you = isYou ( userId, request );

    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final Map<String, Object> model = new HashMap<> ();
    model.put ( "you", you );

    if ( result.hasErrors () )
    {
        model.put ( "command", data );
        return new ModelAndView ( "user/newPassword", model );
    }

    try
    {
        if ( !you /* but we are ADMIN */ )
        {
            this.storage.updatePassword ( userId, null, data.getPassword () );
        }
        else
        {
            this.storage.updatePassword ( userId, data.getCurrentPassword (), data.getPassword () );
        }

        return new ModelAndView ( "redirect:/user/" + userId + "/view" );
    }
    catch ( final Exception e )
    {
        return CommonController.createError ( "Error", "Failed to change password", e );
    }
}
项目:class-guard    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:class-guard    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:class-guard    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:class-guard    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:package-drone    文件:HttpContraintControllerInterceptor.java   
public static boolean isAllowed ( final HttpConstraint constraint, final HttpServletRequest request )
{
    final EmptyRoleSemantic empty = constraint.value ();
    final String[] allowedRoles = constraint.rolesAllowed ();

    if ( allowedRoles == null || allowedRoles.length <= 0 )
    {
        // no roles
        if ( EmptyRoleSemantic.PERMIT.equals ( empty ) )
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        // check all roles .. one is ok

        for ( final String role : allowedRoles )
        {
            if ( request.isUserInRole ( role ) )
            {
                return true;
            }
        }

        // we ran out of options

        return false;
    }
}
项目:package-drone    文件:UserController.java   
@RequestMapping ( "/{userId}/newPassword" )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView changePassword ( @PathVariable ( "userId" ) final String userId, final HttpServletRequest request)
{
    final Map<String, Object> model = new HashMap<> ();

    final boolean you = isYou ( userId, request );
    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final DatabaseUserInformation user = this.storage.getUserDetails ( userId );
    if ( user == null )
    {
        return CommonController.createNotFound ( "user", userId );
    }

    final DatabaseDetails details = user.getDetails ( DatabaseDetails.class );

    if ( details == null )
    {
        return CommonController.createNotFound ( "details", userId );
    }

    final NewPassword data = new NewPassword ();
    data.setEmail ( details.getEmail () );

    model.put ( "you", you );
    model.put ( "command", data );

    return new ModelAndView ( "user/newPassword", model );
}
项目:package-drone    文件:UserController.java   
@RequestMapping ( value = "/{userId}/newPassword", method = RequestMethod.POST )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView changePasswordPost ( @PathVariable ( "userId" ) final String userId, @Valid @FormData ( "command" ) final NewPassword data, final BindingResult result, final HttpServletRequest request)
{
    final boolean you = isYou ( userId, request );

    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final Map<String, Object> model = new HashMap<> ();
    model.put ( "you", you );

    if ( result.hasErrors () )
    {
        model.put ( "command", data );
        return new ModelAndView ( "user/newPassword", model );
    }

    try
    {
        if ( !you /* but we are ADMIN */ )
        {
            this.storage.updatePassword ( userId, null, data.getPassword () );
        }
        else
        {
            this.storage.updatePassword ( userId, data.getCurrentPassword (), data.getPassword () );
        }

        return new ModelAndView ( "redirect:/user/" + userId + "/view" );
    }
    catch ( final Exception e )
    {
        return CommonController.createError ( "Error", "Failed to change password", e );
    }
}
项目:apache-tomcat-7.0.57    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:apache-tomcat-7.0.57    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:apache-tomcat-7.0.57    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:WBSAirback    文件:SecurityConstraint.java   
private static SecurityConstraint createConstraint(
        HttpConstraintElement element, String urlPattern, boolean alwaysCreate) {

    SecurityConstraint constraint = new SecurityConstraint();
    SecurityCollection collection = new SecurityCollection();
    boolean create = alwaysCreate;

    if (element.getTransportGuarantee() !=
            ServletSecurity.TransportGuarantee.NONE) {
        constraint.setUserConstraint(element.getTransportGuarantee().name());
        create = true;
    }
    if (element.getRolesAllowed().length > 0) {
        String[] roles = element.getRolesAllowed();
        for (String role : roles) {
            constraint.addAuthRole(role);
        }
        create = true;
    }
    if (element.getEmptyRoleSemantic() != EmptyRoleSemantic.PERMIT) {
        constraint.setAuthConstraint(true);
        create = true;
    }

    if (create) {
        collection.addPattern(urlPattern);
        constraint.addCollection(collection);
        return constraint;
    }

    return null;
}
项目:WBSAirback    文件:HttpConstraintElement.java   
/**
 * Default constraint is permit with no transport guarantee.
 */
public HttpConstraintElement() {
    // Default constructor
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:WBSAirback    文件:HttpConstraintElement.java   
/**
 * Convenience constructor to specify transport guarantee and/or roles.
 */
public HttpConstraintElement(TransportGuarantee transportGuarantee,
        String... rolesAllowed) {
    this.emptyRoleSemantic = EmptyRoleSemantic.PERMIT;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:WBSAirback    文件:HttpConstraintElement.java   
/**
 * 
 * @param emptyRoleSemantic
 * @param transportGuarantee
 * @param rolesAllowed
 * @throws IllegalArgumentException if roles are specified when DENY is used
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic,
        TransportGuarantee transportGuarantee, String... rolesAllowed) {
    if (rolesAllowed != null && rolesAllowed.length > 0 &&
            EmptyRoleSemantic.DENY.equals(emptyRoleSemantic)) {
        throw new IllegalArgumentException(lStrings.getString(
                "httpConstraintElement.invalidRolesDeny"));
    }
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = transportGuarantee;
    this.rolesAllowed = rolesAllowed;
}
项目:tomcat7    文件:HttpConstraintElement.java   
/**
 * Convenience constructor for {@link EmptyRoleSemantic#DENY}.
 * 
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}
项目:tomcat7    文件:HttpConstraintElement.java   
public EmptyRoleSemantic getEmptyRoleSemantic() {
    return emptyRoleSemantic;
}
项目:lams    文件:HttpConstraintElement.java   
/**
 * Constructs a default HTTP constraint element
 */
public HttpConstraintElement() {
    this(EmptyRoleSemantic.PERMIT);
}
项目:apache-tomcat-7.0.73-with-comment    文件:HttpConstraintElement.java   
/**
 * Convenience constructor for {@link EmptyRoleSemantic#DENY}.
 * 
 */
public HttpConstraintElement(EmptyRoleSemantic emptyRoleSemantic) {
    this.emptyRoleSemantic = emptyRoleSemantic;
    this.transportGuarantee = TransportGuarantee.NONE;
    this.rolesAllowed = new String[0];
}