@SuppressWarnings("ConstantConditions") String webDir = EventHubHandler.class.getClassLoader().getResource("frontend").toExternalForm(); HashLoginService loginService = new HashLoginService(); loginService.putUser(properties.getProperty("eventhubhandler.username"), new Password(properties.getProperty("eventhubhandler.password")), new String[]{"user"});
org.eclipse.jetty.security.LoginService loginService = new org.eclipse.jetty.security.HashLoginService("LoklakRealm", DAO.conf_dir.getAbsolutePath() + "/http_auth"); if(auth) LoklakServer.server.addBean(loginService);
SlaveServer slaveServer = transformationMap.getSlaveServerConfig().getSlaveServer(); if ( !Utils.isEmpty( slaveServer.getPassword() ) ) { hashLoginService = new HashLoginService( "Kettle" ); hashLoginService.putUser( slaveServer.getUsername(), new Password( slaveServer.getPassword() ), new String[] { "default" } ); hashLoginService = new HashLoginService( "Kettle", passwordFile ) { @Override public synchronized UserIdentity putUser( String userName, Credential credential, String[] roles ) { List<String> newRoles = new ArrayList<String>();
private DigestAuthHandler() throws Exception { digestAuthenticator = new DigestAuthenticator(); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); final HashLoginService hashLoginService = new HashLoginService("realm", "src/test/resources/TestInvokeHttp/realm.properties"); hashLoginService.start(); securityHandler.setLoginService(hashLoginService); securityHandler.setIdentityService(new DefaultIdentityService()); digestAuthenticator.setConfiguration(securityHandler); }
if (LOGIN_SERVICE_HASH.equals(loginServiceValue)) { final String usersFilePath = context.getProperty(USERS_PROPERTIES_FILE).evaluateAttributeExpressions().getValue(); loginService = new HashLoginService("HashLoginService", usersFilePath); } else { throw new IllegalArgumentException("Unsupported Login Service: " + loginServiceValue);
org.eclipse.jetty.security.LoginService loginService = new org.eclipse.jetty.security.HashLoginService("LoklakRealm", DAO.conf_dir.getAbsolutePath() + "/http_auth"); if(auth) LoklakInstallation.server.addBean(loginService);
private HashLoginService getLoginService(String pUser, String pPassword, String pRole) { Credential credential = Credential.getCredential(pPassword); HashLoginService loginService = new HashLoginService("jolokia Realm"); loginService.putUser(pUser, credential, new String[] {pRole}); return loginService; }
HashLoginService l = new HashLoginService(); l.setUserStore(userStore); l.setName(realm);
HashLoginService loginService = new HashLoginService(); loginService.putUser("username", new Password("password"), new String[] {"user"}); securityHandler.setLoginService(loginService);
/** * Supply a dummy {@link LoginService} that allows nobody. */ @Override protected LoginService configureUserRealm() { return new HashLoginService(); }
private LoginService buildLoginService() { String jettyUsersFile = ConfigUtil.getConfigFile("jetty-users.properties"); System.setProperty("emissary.jetty.users.file", jettyUsersFile); // for EmissaryClient return new HashLoginService("EmissaryRealm", jettyUsersFile); }
@Override public HashLoginService get() { String authConfig = config.getUserAuthFile(); if (!isNullOrEmpty(authConfig)) { return new HashLoginService(HttpServerModule.REALM_NAME, authConfig); } return null; } }
@Override protected LoginService getHandlerLoginService() { String realmFile = handlerProps.get(Constants.Security.BASIC_REALM_FILE); Path realmFilePath = Paths.get(realmFile); Preconditions.checkArgument(Files.exists(realmFilePath), "File does not exist: %s", realmFilePath); Preconditions.checkArgument(Files.isReadable(realmFilePath), "File is not readable: %s", realmFilePath); HashLoginService loginService = new HashLoginService(); loginService.setConfig(realmFile); loginService.setIdentityService(getHandlerIdentityService()); return loginService; }
@Override public void customize(Server server) { LOG.debug("Customizing server to allow requests for {}", USER_AUTHORIZED); HashLoginService login = new HashLoginService(); login.putUser(USER_AUTHORIZED, Credential.getCredential(USER_PW), new String[] {"users"}); login.setName("users"); Constraint constraint = new Constraint(); constraint.setName(Constraint.__BASIC_AUTH); constraint.setRoles(new String[]{"users"}); constraint.setAuthenticate(true); ConstraintMapping cm = new ConstraintMapping(); cm.setConstraint(constraint); cm.setPathSpec("/*"); ConstraintSecurityHandler security = new ConstraintSecurityHandler(); security.setAuthenticator(new BasicAuthenticator()); security.setRealmName("users"); security.addConstraintMapping(cm); security.setLoginService(login); // chain the PQS handler to security security.setHandler(server.getHandlers()[0]); server.setHandler(security); } }
@Override protected void configureServer(org.eclipse.jetty.server.Server server) throws Exception { URL resource = getClass() .getResource("/org/apache/cxf/systest/jaxrs/security/jetty-realm.properties"); LoginService realm = new HashLoginService("BookStoreRealm", resource.toURI().getPath()); server.addBean(realm); }
private void configureServer() throws Exception { URL resource = getClass().getResource("jetty-realm.properties"); LoginService realm = new HashLoginService("BookStoreRealm", resource.toString()); server.addBean(realm); }
protected ConstraintSecurityHandler configureDigestAuthentication(Server server, AvaticaServerConfiguration config) { final String[] allowedRoles = config.getAllowedRoles(); final String realm = config.getHashLoginServiceRealm(); final String loginServiceProperties = config.getHashLoginServiceProperties(); HashLoginService loginService = new HashLoginService(realm, loginServiceProperties); server.addBean(loginService); return configureCommonAuthentication(Constraint.__DIGEST_AUTH, allowedRoles, new DigestAuthenticator(), null, loginService); }
protected ConstraintSecurityHandler configureBasicAuthentication(Server server, AvaticaServerConfiguration config) { final String[] allowedRoles = config.getAllowedRoles(); final String realm = config.getHashLoginServiceRealm(); final String loginServiceProperties = config.getHashLoginServiceProperties(); HashLoginService loginService = new HashLoginService(realm, loginServiceProperties); server.addBean(loginService); return configureCommonAuthentication(Constraint.__BASIC_AUTH, allowedRoles, new BasicAuthenticator(), null, loginService); }
protected ConstraintSecurityHandler configureBasicAuthentication(Server server, AvaticaServerConfiguration config) { final String[] allowedRoles = config.getAllowedRoles(); final String realm = config.getHashLoginServiceRealm(); final String loginServiceProperties = config.getHashLoginServiceProperties(); HashLoginService loginService = new HashLoginService(realm, loginServiceProperties); server.addBean(loginService); return configureCommonAuthentication(Constraint.__BASIC_AUTH, allowedRoles, new BasicAuthenticator(), null, loginService); }
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", "etc/rest-users.properties")); return handler; }