mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
feat(codeartifact): serve the maven format through a real Reposilite-backed proxy (#4059)
GetRepositoryEndpoint for format=maven now returns a URL real Maven clients (mvn deploy, mvn dependency:get, Gradle) can publish to and resolve from directly, backed by a shared Reposilite sidecar container started lazily on first use. A CodeArtifact repository maps to its own Reposilite repository, provisioned automatically and never reused even across delete/recreate of a same-named repository, so a fresh repository can never inherit a previous one's artifacts. Adds GetAuthorizationToken (a token scoped to a domain, with the 900-43200s custom range; 0 falls back to 12 hours) and requires it on every Maven proxy request, either as the password of HTTP Basic credentials, the form AWS's Maven guide configures with username aws, or as a Bearer token. Maven requests are not SigV4-signed, so the region and account come from the token. Also enforces AWS's 5 GB asset size quota on the Maven endpoint, matching the existing PublishPackageVersion check. Artifacts do not survive a Floci restart; the service page documents this as a known limitation.
This commit is contained in:
1 parent
06007deea8
commit
0524d156d4
17 files changed
+1525
-11
No files matched your search
@@ -12,6 +12,7 @@ import software.amazon.awssdk.services.codeartifact.model.Tag;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -84,6 +85,32 @@ class CodeArtifactTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(12)
|
||||
@DisplayName("GetAuthorizationToken - returns a bearer token and a future expiration")
|
||||
void getAuthorizationTokenReturnsATokenAndExpiration() {
|
||||
GetAuthorizationTokenResponse resp = codeArtifact.getAuthorizationToken(r -> r.domain(DOMAIN));
|
||||
|
||||
assertThat(resp.authorizationToken()).isNotBlank();
|
||||
assertThat(resp.expiration()).isAfter(Instant.now());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(13)
|
||||
@DisplayName("GetAuthorizationToken - fails against a domain that does not exist")
|
||||
void getAuthorizationTokenMissingDomainFails() {
|
||||
assertThatThrownBy(() -> codeArtifact.getAuthorizationToken(r -> r.domain("does-not-exist-domain")))
|
||||
.isInstanceOf(ResourceNotFoundException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(14)
|
||||
@DisplayName("GetAuthorizationToken - rejects a duration outside 0 or 900-43200")
|
||||
void getAuthorizationTokenRejectsAnInvalidDuration() {
|
||||
assertThatThrownBy(() -> codeArtifact.getAuthorizationToken(r -> r.domain(DOMAIN).durationSeconds(60L)))
|
||||
.isInstanceOf(ValidationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(20)
|
||||
@DisplayName("CreateRepository - fails against a domain that does not exist")
|
||||
|
||||
Reference in new issue
Block a user