Java Code Examples for org.eclipse.jetty.util.security.Constraint#DC_NONE
The following examples show how to use
org.eclipse.jetty.util.security.Constraint#DC_NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaxWebIntegrationService.java From keycloak with Apache License 2.0 | 6 votes |
protected void addConstraintMapping(WebContainer service, ConstraintMapping constraintMapping) { Constraint constraint = constraintMapping.getConstraint(); String[] roles = constraint.getRoles(); // name property is unavailable on constraint object :/ String name = "Constraint-" + new SecureRandom().nextInt(Integer.MAX_VALUE); int dataConstraint = constraint.getDataConstraint(); String dataConstraintStr; switch (dataConstraint) { case Constraint.DC_UNSET: dataConstraintStr = null; break; case Constraint.DC_NONE: dataConstraintStr = "NONE"; break; case Constraint.DC_CONFIDENTIAL: dataConstraintStr = "CONFIDENTIAL"; break; case Constraint.DC_INTEGRAL: dataConstraintStr = "INTEGRAL"; break; default: log.warnv("Unknown data constraint: " + dataConstraint); dataConstraintStr = "CONFIDENTIAL"; } List<String> rolesList = Arrays.asList(roles); log.debug("Adding security constraint name=" + name + ", url=" + constraintMapping.getPathSpec() + ", dataConstraint=" + dataConstraintStr + ", canAuthenticate=" + constraint.getAuthenticate() + ", roles=" + rolesList); service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext); }
Example 2
Source File: PaxWebIntegrationService.java From keycloak with Apache License 2.0 | 6 votes |
protected void addConstraintMapping(WebContainer service, ConstraintMapping constraintMapping) { Constraint constraint = constraintMapping.getConstraint(); String[] roles = constraint.getRoles(); // name property is unavailable on constraint object :/ String name = "Constraint-" + new SecureRandom().nextInt(Integer.MAX_VALUE); int dataConstraint = constraint.getDataConstraint(); String dataConstraintStr; switch (dataConstraint) { case Constraint.DC_UNSET: dataConstraintStr = null; break; case Constraint.DC_NONE: dataConstraintStr = "NONE"; break; case Constraint.DC_CONFIDENTIAL: dataConstraintStr = "CONFIDENTIAL"; break; case Constraint.DC_INTEGRAL: dataConstraintStr = "INTEGRAL"; break; default: log.warnv("Unknown data constraint: " + dataConstraint); dataConstraintStr = "CONFIDENTIAL"; } List<String> rolesList = Arrays.asList(roles); log.debug("Adding security constraint name=" + name + ", url=" + constraintMapping.getPathSpec() + ", dataConstraint=" + dataConstraintStr + ", canAuthenticate=" + constraint.getAuthenticate() + ", roles=" + rolesList); service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext); }
Example 3
Source File: PaxWebIntegrationService.java From keycloak with Apache License 2.0 | 5 votes |
@Override public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) { if (cm instanceof ConstraintMapping) { ConstraintMapping constraintMapping = (ConstraintMapping) cm; Constraint constraint = constraintMapping.getConstraint(); String[] roles = constraint.getRoles(); // name property is unavailable on constraint object :/ String name = "Constraint-" + new SecureRandom().nextInt(Integer.MAX_VALUE); int dataConstraint = constraint.getDataConstraint(); String dataConstraintStr; switch (dataConstraint) { case Constraint.DC_UNSET: dataConstraintStr = null; break; case Constraint.DC_NONE: dataConstraintStr = "NONE"; break; case Constraint.DC_CONFIDENTIAL: dataConstraintStr = "CONFIDENTIAL"; break; case Constraint.DC_INTEGRAL: dataConstraintStr = "INTEGRAL"; break; default: log.warnv("Unknown data constraint: " + dataConstraint); dataConstraintStr = "CONFIDENTIAL"; } List<String> rolesList = Arrays.asList(roles); log.debug("Adding security constraint name=" + name + ", url=" + constraintMapping.getPathSpec() + ", dataConstraint=" + dataConstraintStr + ", canAuthenticate=" + constraint.getAuthenticate() + ", roles=" + rolesList); service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext); return true; } return false; }
Example 4
Source File: PaxWebIntegrationService.java From keycloak with Apache License 2.0 | 5 votes |
public boolean addConstraintMapping(HttpContext httpContext, WebContainer service, Object cm) { if (cm instanceof ConstraintMapping) { ConstraintMapping constraintMapping = (ConstraintMapping) cm; Constraint constraint = constraintMapping.getConstraint(); String[] roles = constraint.getRoles(); // name property is unavailable on constraint object :/ String name = "Constraint-" + new SecureRandom().nextInt(Integer.MAX_VALUE); int dataConstraint = constraint.getDataConstraint(); String dataConstraintStr; switch (dataConstraint) { case Constraint.DC_UNSET: dataConstraintStr = null; break; case Constraint.DC_NONE: dataConstraintStr = "NONE"; break; case Constraint.DC_CONFIDENTIAL: dataConstraintStr = "CONFIDENTIAL"; break; case Constraint.DC_INTEGRAL: dataConstraintStr = "INTEGRAL"; break; default: log.warnv("Unknown data constraint: " + dataConstraint); dataConstraintStr = "CONFIDENTIAL"; } List<String> rolesList = Arrays.asList(roles); log.debug("Adding security constraint name=" + name + ", url=" + constraintMapping.getPathSpec() + ", dataConstraint=" + dataConstraintStr + ", canAuthenticate=" + constraint.getAuthenticate() + ", roles=" + rolesList); service.registerConstraintMapping(name, constraintMapping.getPathSpec(), null, dataConstraintStr, constraint.getAuthenticate(), rolesList, httpContext); return true; } return false; }