@Override public HotRodServer createStartHotRodServer(EmbeddedCacheManager cacheManager) { SimpleServerAuthenticationProvider ssap = new SimpleServerAuthenticationProvider(); ssap.addUser("user", "realm", "password".toCharArray()); HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.authentication().enable().addAllowedMech("CRAM-MD5").serverAuthenticationProvider(ssap) .serverName("localhost").addMechProperty(Sasl.POLICY_NOANONYMOUS, "true"); return startHotRodServer(cacheManager, HotRodTestingUtil.serverPort(), 0, builder); }
@Override public HotRodServerConfiguration create() { return new HotRodServerConfiguration(attributes.protect(), ssl.create(), authentication.create()); }
@Override public HotRodServerConfigurationBuilder read(HotRodServerConfiguration template) { super.read(template); this.authentication.read(template.authentication()); return this; }
hotRodBuilder.authentication().serverSubject(getServerSubject(serverContextName)); hotRodBuilder.authentication().serverAuthenticationProvider(new EndpointServerAuthenticationProvider(authenticationRealm));
@Override public void validate() { super.validate(); if (attributes.attribute(PROXY_HOST).isNull() && attributes.attribute(HOST).isNull()) { throw log.missingHostAddress(); } authentication.validate(); }
private void processAuthentication(OperationContext context, HotRodServerConfigurationBuilder configurationBuilder, ProtocolServerService service, ServiceBuilder<?> builder, ModelNode config) throws OperationFailedException { if (config.hasDefined(ModelKeys.AUTHENTICATION) && config.get(ModelKeys.AUTHENTICATION, ModelKeys.AUTHENTICATION_NAME).isDefined()) { configurationBuilder.authentication().enable(); ModelNode authentication = config.get(ModelKeys.AUTHENTICATION, ModelKeys.AUTHENTICATION_NAME); authenticationBuilder.serverName(SaslResource.SERVER_NAME.resolveModelAttribute(context, sasl).asString()); authenticationBuilder.addAllowedMech(mech.asString()); authenticationBuilder.addMechProperty(Sasl.QOP, qop); authenticationBuilder.addMechProperty(Sasl.STRENGTH, strength); switch (property.getName()) { case ModelKeys.FORWARD_SECRECY: authenticationBuilder.addMechProperty(Sasl.POLICY_FORWARD_SECRECY, value); break; case ModelKeys.NO_ACTIVE: authenticationBuilder.addMechProperty(Sasl.POLICY_NOACTIVE, value); break; case ModelKeys.NO_ANONYMOUS: authenticationBuilder.addMechProperty(Sasl.POLICY_NOANONYMOUS, value); break; case ModelKeys.NO_DICTIONARY: authenticationBuilder.addMechProperty(Sasl.POLICY_NODICTIONARY, value); break; case ModelKeys.NO_PLAIN_TEXT: authenticationBuilder.addMechProperty(Sasl.POLICY_NOPLAINTEXT, value); break; case ModelKeys.PASS_CREDENTIALS:
serverBuilder .authentication() .enable() .serverName("localhost") .addAllowedMech("EXTERNAL") .serverAuthenticationProvider(sap); hrServer = new HotRodServer(); hrServer.start(serverBuilder.build(), localCacheManager);