easy code added for simplicity (#2473)

* moving jmh into libraries module

* refactoring jmh

* Update pom.xml

* manual algorightm

* with BM result

* fix for space issue

* Fixed indentation

* change as per suggestion

* vavr either

* adding unit test and othe rutilities

* adding concurrent module

* concurrent package description

* concurrent package description

* Update EitherUnitTest.java

* introducing lambda expression

* jooby project

* jooby project

* reducing employee bean content

* bootique module

* bootique

* bootique

* undertow module

* undertow module

* refactoring

* using lambda

* as per baeldung formatter

* easy code added for simplicity
This commit is contained in:
Abhinab Kanrar 2017-08-21 16:30:44 +05:30 committed by Grzegorz Piwowarek
parent e6c2fd3bbe
commit def5758f0a
2 changed files with 7 additions and 4 deletions

View File

@ -8,9 +8,10 @@ import java.util.Set;
import io.undertow.security.idm.Account;
import io.undertow.security.idm.Credential;
import io.undertow.security.idm.IdentityManager;
import io.undertow.security.idm.PasswordCredential;
public class CustomIdentityManager implements io.undertow.security.idm.IdentityManager {
public class CustomIdentityManager implements IdentityManager {
private final Map<String, char[]> users;

View File

@ -29,13 +29,15 @@ public class SecureServer {
final IdentityManager idm = new CustomIdentityManager(users);
Undertow server = Undertow.builder().addHttpListener(8080, "localhost").setHandler(addSecurity((exchange) -> {
final SecurityContext context = exchange.getSecurityContext();
exchange.getResponseSender().send("Hello " + context.getAuthenticatedAccount().getPrincipal().getName(),
IoCallback.END_EXCHANGE);
setExchange(exchange);
}, idm)).build();
server.start();
}
private static void setExchange(HttpServerExchange exchange) {
final SecurityContext context = exchange.getSecurityContext();
exchange.getResponseSender().send("Hello " + context.getAuthenticatedAccount().getPrincipal().getName(),IoCallback.END_EXCHANGE);
}
private static HttpHandler addSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {