本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.getSecurityHandler()
方法的一些代码示例,展示了WebAppContext.getSecurityHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.getSecurityHandler()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:getSecurityHandler
暂无
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
/**
* Servlet spec 3.1. When present in web.xml, this means that http methods that are
* not covered by security constraints should have access denied.
* <p>
* See section 13.8.4, pg 145
*
* @param context the of the processing
* @param descriptor the descriptor
* @param node the xml node
*/
public void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
if (context.getSecurityHandler() == null)
{
LOG.warn("deny-uncovered-http-methods declared but SecurityHandler==null");
return;
}
((ConstraintAware)context.getSecurityHandler()).setDenyUncoveredHttpMethods(true);
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
if (context.getSecurityHandler() == null)
{
LOG.warn("security-role declared but SecurityHandler==null");
return;
}
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
((ConstraintAware)getSecurityHandler()).addConstraintMapping(m);
((ConstraintAware)getSecurityHandler()).checkPathsWithUncoveredHttpMethods();
getMetaData().setOriginAPI("constraint.url."+pathSpec);
break;
List<ConstraintMapping> constraintMappings = ConstraintSecurityHandler.removeConstraintMappingsForPath(pathSpec, ((ConstraintAware)getSecurityHandler()).getConstraintMappings());
((ConstraintSecurityHandler)getSecurityHandler()).setConstraintMappings(constraintMappings);
((ConstraintAware)getSecurityHandler()).checkPathsWithUncoveredHttpMethods();
break;
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
context.getSecurityHandler().setAuthMethod(method.toString(false, true));
context.getMetaData().setOrigin("auth-method", descriptor);
break;
context.getSecurityHandler().setAuthMethod(method.toString(false, true));
context.getMetaData().setOrigin("auth-method", descriptor);
if (!context.getSecurityHandler().getAuthMethod().equals(method.toString(false, true)))
throw new IllegalStateException("Conflicting auth-method value in "+descriptor.getResource());
break;
context.getSecurityHandler().setRealmName(nameStr);
context.getMetaData().setOrigin("realm-name", descriptor);
break;
context.getSecurityHandler().setRealmName(nameStr);
context.getMetaData().setOrigin("realm-name", descriptor);
if (!context.getSecurityHandler().getRealmName().equals(nameStr))
throw new IllegalStateException("Conflicting realm-name value in "+descriptor.getResource());
break;
if (Constraint.__FORM_AUTH.equalsIgnoreCase(context.getSecurityHandler().getAuthMethod()))
context.getSecurityHandler().setInitParameter(FormAuthenticator.__FORM_LOGIN_PAGE,loginPageName);
context.getMetaData().setOrigin("form-login-page",descriptor);
break;
context.getSecurityHandler().setInitParameter(FormAuthenticator.__FORM_LOGIN_PAGE,loginPageName);
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
public void visitSecurityConstraint(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
if (context.getSecurityHandler() == null)
mapping.setPathSpec(url);
mapping.setConstraint(sc);
((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping);
mapping.setPathSpec(url);
mapping.setConstraint(sc);
((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping);
mapping.setPathSpec(url);
mapping.setConstraint(sc);
((ConstraintAware)context.getSecurityHandler()).addConstraintMapping(mapping);
代码示例来源:origin: jenkinsci/winstone
/**
* Servlet spec 3.1. When present in web.xml, this means that http methods that are
* not covered by security constraints should have access denied.
* <p>
* See section 13.8.4, pg 145
*
* @param context the of the processing
* @param descriptor the descriptor
* @param node the xml node
*/
public void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
if (context.getSecurityHandler() == null)
{
LOG.warn("deny-uncovered-http-methods declared but SecurityHandler==null");
return;
}
((ConstraintAware)context.getSecurityHandler()).setDenyUncoveredHttpMethods(true);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler#doHandle(java.lang.Class)
*/
public void doHandle(Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
return; //only applicable on javax.servlet.Servlet derivatives
DeclareRoles declareRoles = (DeclareRoles) clazz.getAnnotation(DeclareRoles.class);
if (declareRoles == null)
return;
String[] roles = declareRoles.value();
if (roles != null && roles.length > 0)
{
for (String r:roles)
((ConstraintSecurityHandler)_context.getSecurityHandler()).addRole(r);
}
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler#doHandle(java.lang.Class)
*/
public void doHandle(Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
return; //only applicable on javax.servlet.Servlet derivatives
DeclareRoles declareRoles = (DeclareRoles) clazz.getAnnotation(DeclareRoles.class);
if (declareRoles == null)
return;
String[] roles = declareRoles.value();
if (roles != null && roles.length > 0)
{
for (String r:roles)
((ConstraintSecurityHandler)_context.getSecurityHandler()).addRole(r);
}
}
代码示例来源:origin: jenkinsci/winstone
public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
if (context.getSecurityHandler() == null)
{
LOG.warn("security-role declared but SecurityHandler==null");
return;
}
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @see org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler#doHandle(java.lang.Class)
*/
public void doHandle(Class clazz)
{
if (!Servlet.class.isAssignableFrom(clazz))
return; //only applicable on javax.servlet.Servlet derivatives
DeclareRoles declareRoles = (DeclareRoles) clazz.getAnnotation(DeclareRoles.class);
if (declareRoles == null)
return;
String[] roles = declareRoles.value();
if (roles != null && roles.length > 0)
{
for (String r:roles)
((ConstraintSecurityHandler)_context.getSecurityHandler()).addRole(r);
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @param context
* @param descriptor
* @param node
*/
protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* @param context
* @param descriptor
* @param node
*/
protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
/**
* @param context
* @param descriptor
* @param node
*/
protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
/**
* @param context
* @param descriptor
* @param node
*/
protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
/**
* @param context
* @param descriptor
* @param node
*/
protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
//ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged
XmlParser.Node roleNode = node.get("role-name");
String role = roleNode.toString(false, true);
((ConstraintAware)context.getSecurityHandler()).addRole(role);
}
代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup
/**
* Sets up Jetty without any actual TCP port serving HTTP.
*/
@Override
protected ServletContext createWebServer() throws Exception {
QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10);
server = new Server(queuedThreadPool);
WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
server.setHandler(context);
context.getSecurityHandler().setLoginService(configureUserRealm());
context.setResourceBase(bootstrap.warDir.getPath());
server.start();
localPort = -1;
setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir));
return context.getServletContext();
}
代码示例来源:origin: jenkinsci/jenkinsfile-runner
/**
* Sets up Jetty without any actual TCP port serving HTTP.
*/
@Override
protected ServletContext createWebServer() throws Exception {
QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10);
server = new Server(queuedThreadPool);
WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath);
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
server.setHandler(context);
context.getSecurityHandler().setLoginService(configureUserRealm());
context.setResourceBase(bootstrap.warDir.getPath());
server.start();
localPort = -1;
setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir));
return context.getServletContext();
}
代码示例来源:origin: weld/core
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception {
EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext());
wac.setServletHandler(wHandler);
wac.getSecurityHandler().setHandler(wHandler);
if (startNewHandler) {
wHandler.start();
}
Resource jettyEnv = null;
Resource webInf = wac.getWebInf();
if (webInf != null && webInf.exists()) {
jettyEnv = webInf.addPath("jetty-env.xml");
}
if (jettyEnv == null || !(jettyEnv.exists())) {
JettyLogger.LOG.missingJettyEnvXml();
}
}
代码示例来源:origin: weld/core
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception {
EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext());
wac.setServletHandler(wHandler);
wac.getSecurityHandler().setHandler(wHandler);
if (startNewHandler) {
wHandler.start();
}
Resource jettyEnv = null;
Resource webInf = wac.getWebInf();
if (webInf != null && webInf.exists()) {
jettyEnv = webInf.addPath("jetty-env.xml");
}
if (jettyEnv == null || !(jettyEnv.exists())) {
JettyLogger.LOG.missingJettyEnvXml();
}
}
代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception {
EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext());
wac.setServletHandler(wHandler);
wac.getSecurityHandler().setHandler(wHandler);
if (startNewHandler) {
wHandler.start();
}
Resource jettyEnv = null;
Resource webInf = wac.getWebInf();
if (webInf != null && webInf.exists()) {
jettyEnv = webInf.addPath("jetty-env.xml");
}
if (jettyEnv == null || !(jettyEnv.exists())) {
JettyLogger.LOG.missingJettyEnvXml();
}
}
内容来源于网络,如有侵权,请联系作者删除!