Search in sources :

Example 1 with BasicAuthenticator

use of com.artipie.http.client.auth.BasicAuthenticator in project maven-adapter by artipie.

the class MavenProxySliceAuthIT method setUp.

@BeforeEach
void setUp() throws Exception {
    final Storage storage = new InMemoryStorage();
    new TestResource("com/artipie/helloworld").addFilesTo(storage, new Key.From("com", "artipie", "helloworld"));
    final String username = "alice";
    final String password = "qwerty";
    this.server = new VertxSliceServer(MavenProxySliceAuthIT.VERTX, new LoggingSlice(new MavenSlice(storage, (user, action) -> user.name().equals(username), new Authentication.Single(username, password))));
    final int port = this.server.start();
    this.client.start();
    this.proxy = new LoggingSlice(new MavenProxySlice(this.client, URI.create(String.format("http://localhost:%d", port)), new BasicAuthenticator(username, password), Cache.NOP));
}
Also used : RqMethod(com.artipie.http.rq.RqMethod) BeforeEach(org.junit.jupiter.api.BeforeEach) Headers(com.artipie.http.Headers) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Slice(com.artipie.http.Slice) LoggingSlice(com.artipie.http.slice.LoggingSlice) RsStatus(com.artipie.http.rs.RsStatus) Content(com.artipie.asto.Content) Key(com.artipie.asto.Key) Disabled(org.junit.jupiter.api.Disabled) RsHasStatus(com.artipie.http.hm.RsHasStatus) Test(org.junit.jupiter.api.Test) RequestLine(com.artipie.http.rq.RequestLine) Vertx(io.vertx.reactivex.core.Vertx) AfterEach(org.junit.jupiter.api.AfterEach) MatcherAssert(org.hamcrest.MatcherAssert) Storage(com.artipie.asto.Storage) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) VertxSliceServer(com.artipie.vertx.VertxSliceServer) BasicAuthenticator(com.artipie.http.client.auth.BasicAuthenticator) Cache(com.artipie.asto.cache.Cache) URI(java.net.URI) Authentication(com.artipie.http.auth.Authentication) TestResource(com.artipie.asto.test.TestResource) TestResource(com.artipie.asto.test.TestResource) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Storage(com.artipie.asto.Storage) VertxSliceServer(com.artipie.vertx.VertxSliceServer) BasicAuthenticator(com.artipie.http.client.auth.BasicAuthenticator) Key(com.artipie.asto.Key) LoggingSlice(com.artipie.http.slice.LoggingSlice) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Content (com.artipie.asto.Content)1 Key (com.artipie.asto.Key)1 Storage (com.artipie.asto.Storage)1 Cache (com.artipie.asto.cache.Cache)1 InMemoryStorage (com.artipie.asto.memory.InMemoryStorage)1 TestResource (com.artipie.asto.test.TestResource)1 Headers (com.artipie.http.Headers)1 Slice (com.artipie.http.Slice)1 Authentication (com.artipie.http.auth.Authentication)1 BasicAuthenticator (com.artipie.http.client.auth.BasicAuthenticator)1 JettyClientSlices (com.artipie.http.client.jetty.JettyClientSlices)1 RsHasStatus (com.artipie.http.hm.RsHasStatus)1 RequestLine (com.artipie.http.rq.RequestLine)1 RqMethod (com.artipie.http.rq.RqMethod)1 RsStatus (com.artipie.http.rs.RsStatus)1 LoggingSlice (com.artipie.http.slice.LoggingSlice)1 VertxSliceServer (com.artipie.vertx.VertxSliceServer)1 Vertx (io.vertx.reactivex.core.Vertx)1 URI (java.net.URI)1 MatcherAssert (org.hamcrest.MatcherAssert)1