当前位置: 首页>>代码示例>>Java>>正文


Java ConstraintMapping.setPathSpec方法代码示例

本文整理汇总了Java中org.eclipse.jetty.security.ConstraintMapping.setPathSpec方法的典型用法代码示例。如果您正苦于以下问题:Java ConstraintMapping.setPathSpec方法的具体用法?Java ConstraintMapping.setPathSpec怎么用?Java ConstraintMapping.setPathSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.security.ConstraintMapping的用法示例。


在下文中一共展示了ConstraintMapping.setPathSpec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String realm)
{
	HashLoginService l = new HashLoginService();
	l.setConfig(new File(PlatformData.installationDirectory, "webusers.properties").getAbsolutePath());
	l.setName(realm);
	Constraint constraint = new Constraint();
	constraint.setName(Constraint.__BASIC_AUTH);
	constraint.setRoles(new String[] { "user" });
	constraint.setAuthenticate(true);
	ConstraintMapping cm = new ConstraintMapping();
	cm.setConstraint(constraint);
	cm.setPathSpec("/ui/*");
	ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
	csh.setAuthenticator(new BasicAuthenticator());
	csh.setRealmName("myrealm");
	csh.addConstraintMapping(cm);
	csh.setLoginService(l);
	return csh;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:20,代码来源:WebServer.java

示例2: InMemoryIdentityManager

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
public InMemoryIdentityManager() {
	loginService = new HashLoginService();
	loginService.setName(realm);

	securityHandler = new ConstraintSecurityHandler();
	securityHandler.setAuthenticator(new BasicAuthenticator());
	securityHandler.setRealmName(realm);
	securityHandler.setLoginService(loginService);

	Constraint constraint = new Constraint();
	constraint.setName(Constraint.__BASIC_AUTH);
	//		constraint.setRoles(new String[] { "getRole", "postRole", "allRole" });
	constraint.setRoles(new String[]{Constraint.ANY_AUTH, "getRole", "postRole", "allRole"});
	constraint.setAuthenticate(true);

	ConstraintMapping cm = new ConstraintMapping();
	cm.setConstraint(constraint);
	cm.setPathSpec("/*");
	securityHandler.addConstraintMapping(cm);
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:21,代码来源:InMemoryIdentityManager.java

示例3: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String realm) {

    	final OfMeetLoginService loginService = new OfMeetLoginService();
        loginService.setName(realm);

        final Constraint constraint = new Constraint();
        constraint.setName( Constraint.__BASIC_AUTH );
        constraint.setRoles( new String[] { "ofmeet" } );
        constraint.setAuthenticate( true );

        final ConstraintMapping constraintMapping = new ConstraintMapping();
        constraintMapping.setConstraint( constraint );
        constraintMapping.setPathSpec( "/*" );

        final ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
        securityHandler.setAuthenticator( new BasicAuthenticator() );
        securityHandler.setRealmName( realm );
        securityHandler.addConstraintMapping( constraintMapping );
        securityHandler.setLoginService( loginService );

        return securityHandler;
    }
 
开发者ID:igniterealtime,项目名称:ofmeet-openfire-plugin,代码行数:23,代码来源:OfMeetPlugin.java

示例4: configureCommonAuthentication

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
protected ConstraintSecurityHandler configureCommonAuthentication(Server server,
    ServerConnector connector, AvaticaServerConfiguration config, String constraintName,
    String[] allowedRoles, Authenticator authenticator, String realm,
    LoginService loginService) {

  Constraint constraint = new Constraint();
  constraint.setName(constraintName);
  constraint.setRoles(allowedRoles);
  // This is telling Jetty to not allow unauthenticated requests through (very important!)
  constraint.setAuthenticate(true);

  ConstraintMapping cm = new ConstraintMapping();
  cm.setConstraint(constraint);
  cm.setPathSpec("/*");

  ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
  sh.setAuthenticator(authenticator);
  sh.setLoginService(loginService);
  sh.setConstraintMappings(new ConstraintMapping[]{cm});
  sh.setRealmName(realm);

  return sh;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:24,代码来源:HttpServer.java

示例5: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String username, String password, String realm) {

    HashLoginService l = new HashLoginService();
    l.putUser(username, Credential.getCredential(password), new String[] {"user"});
    l.setName(realm);

    Constraint constraint = new Constraint();
    constraint.setName(Constraint.__BASIC_AUTH);
    constraint.setRoles(new String[] {"user"});
    constraint.setAuthenticate(true);

    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");

    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new ProxyAuthenticator());
    csh.setRealmName("myrealm");
    csh.addConstraintMapping(cm);
    csh.setLoginService(l);

    return csh;

  }
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:25,代码来源:Proxy.java

示例6: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String username, String password, String realm) {
  HashLoginService l = new HashLoginService();
    l.putUser(username, Credential.getCredential(password), new String[] {"user"});
    l.setName(realm);
    
    Constraint constraint = new Constraint();
    constraint.setName(Constraint.__BASIC_AUTH);
    constraint.setRoles(new String[]{"user"});
    constraint.setAuthenticate(true);
     
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
    csh.setRealmName("myrealm");
    csh.addConstraintMapping(cm);
    csh.setLoginService(l);
    
    return csh;      
}
 
开发者ID:ppkpub,项目名称:javatool,代码行数:23,代码来源:JsonRpcServletEngine.java

示例7: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private SecurityHandler basicAuth(String username, String password, String realm) {

        HashLoginService l = new HashLoginService();
        l.putUser(username, Credential.getCredential(password), new String[]{"user"});
        l.setName(realm);

        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);
        constraint.setRoles(new String[]{"user"});
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");

        ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
        csh.setAuthenticator(new BasicAuthenticator());
        csh.setRealmName("myrealm");
        csh.addConstraintMapping(cm);
        csh.setLoginService(l);

        return csh;

    }
 
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:JettyTestServer.java

示例8: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private SecurityHandler basicAuth(String username, String password, String realm) {
    HashLoginService l = new HashLoginService();
    l.putUser(username, Credential.getCredential(password), new String[]{"user"});
    l.setName(realm);

    Constraint constraint = new Constraint();
    constraint.setName(Constraint.__BASIC_AUTH);
    constraint.setRoles(new String[]{"user"});
    constraint.setAuthenticate(true);

    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");

    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
    csh.setRealmName("myrealm");
    csh.addConstraintMapping(cm);
    csh.setLoginService(l);

    return csh;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:JettyTestServer.java

示例9: getSecurityHandler

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private SecurityHandler getSecurityHandler() throws IOException {
    Constraint constraint = new Constraint(Constraint.__BASIC_AUTH, "user");
    constraint.setAuthenticate(true);

    ConstraintMapping cm = new ConstraintMapping();
    cm.setPathSpec("/*");
    cm.setConstraint(constraint);

    ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
    sh.setAuthenticator(new BasicAuthenticator());
    sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[] {cm}));

    HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
    sh.setLoginService(loginService);
    sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[]{cm}));

    return sh;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:HttpAuthMethodPriorityTest.java

示例10: createSecurityHandler

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
@Produces
@Named("securityHandler")
public static ConstraintSecurityHandler createSecurityHandler() {
    Constraint constraint = new Constraint("BASIC", "customer");
    constraint.setAuthenticate(true);

    ConstraintMapping mapping = new ConstraintMapping();
    mapping.setConstraint(constraint);
    mapping.setPathSpec("/*");

    ConstraintSecurityHandler handler = new ConstraintSecurityHandler();
    handler.addConstraintMapping(mapping);
    handler.setAuthenticator(new BasicAuthenticator());
    handler.setLoginService(new HashLoginService("RiderAutoParts", "src/main/resources/users.properties"));

    return handler;
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:18,代码来源:JettySecurity.java

示例11: addServlet

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private void addServlet(final Servlet servlet, final String path,
		WebPermission... permissions) {
	servletContextHandler.addServlet(new ServletHolder(servlet), path);
	if (permissions != null && permissions.length > 0) {
		for (WebPermission p : permissions) {
			Constraint constraint = getConstraintForPermission(p);
			ConstraintMapping mapping = new ConstraintMapping();
			mapping.setPathSpec(servletContextHandler.getContextPath()
					+ path);
			mapping.setConstraint(constraint);
			if (p.hasMethod()) {
				mapping.setMethod(p.getMethod().name());
			}
			constraintMappings.add(mapping);
		}
	}

	LOGGER.info("Servlet added on path {}", path);
}
 
开发者ID:dstl,项目名称:baleen,代码行数:20,代码来源:BaleenWebApi.java

示例12: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String username, String password, String realm) {
	HashLoginService l = new HashLoginService();
    l.putUser(username, Credential.getCredential(password), new String[] {"user"});
    l.setName(realm);
    
    Constraint constraint = new Constraint();
    constraint.setName(Constraint.__BASIC_AUTH);
    constraint.setRoles(new String[]{"user"});
    constraint.setAuthenticate(true);
     
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
    csh.setRealmName("myrealm");
    csh.addConstraintMapping(cm);
    csh.setLoginService(l);
    
    return csh;    	
}
 
开发者ID:newbiecoin,项目名称:newbiecoinj,代码行数:23,代码来源:JsonRpcServletEngine.java

示例13: constrainHttpMethods

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
/**
 * Add constraints to a Jetty Context to disallow undesirable Http methods.
 * @param ctxHandler The context to modify
 */
public static void constrainHttpMethods(ServletContextHandler ctxHandler) {
  Constraint c = new Constraint();
  c.setAuthenticate(true);

  ConstraintMapping cmt = new ConstraintMapping();
  cmt.setConstraint(c);
  cmt.setMethod("TRACE");
  cmt.setPathSpec("/*");

  ConstraintMapping cmo = new ConstraintMapping();
  cmo.setConstraint(c);
  cmo.setMethod("OPTIONS");
  cmo.setPathSpec("/*");

  ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
  securityHandler.setConstraintMappings(new ConstraintMapping[]{ cmt, cmo });

  ctxHandler.setSecurityHandler(securityHandler);
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:HttpServerUtil.java

示例14: BasicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
public BasicAuth() {

        HashLoginService loginService = new HashLoginService();
        loginService.putUser(Main.configuration.username, Credential.getCredential(Main.configuration.password), new String[]{"user"});
        loginService.setName(Main.configuration.realm);

        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);
        constraint.setRoles(new String[]{"user"});
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");

        // Configure this ConstraintSecurityHandler:
        setAuthenticator(new BasicAuthenticator());
        setRealmName("myrealm");
        addConstraintMapping(cm);
        setLoginService(loginService);
    }
 
开发者ID:davidcarboni,项目名称:restolino,代码行数:22,代码来源:BasicAuth.java

示例15: basicAuth

import org.eclipse.jetty.security.ConstraintMapping; //导入方法依赖的package包/类
private static final SecurityHandler basicAuth(String username, String password, String realm) {

        HashLoginService l = new HashLoginService();
        l.putUser(username, Credential.getCredential(password), new String[] {"user"});
        l.setName(realm);

        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);
        constraint.setRoles(new String[]{"user"});
        constraint.setAuthenticate(true);

        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");

        ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
        csh.setAuthenticator(new BasicAuthenticator());
        csh.setRealmName(realm);
        csh.addConstraintMapping(cm);
        csh.setLoginService(l);

        return csh;

    }
 
开发者ID:lucidworks,项目名称:solr-couchbase-plugin,代码行数:25,代码来源:CAPIServer.java


注:本文中的org.eclipse.jetty.security.ConstraintMapping.setPathSpec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。