mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
feat(ssoadmin): serve Identity Center ListInstances (#2581)
* feat(sso): serve Identity Center ListInstances under SWBExternalService
LZA's Custom::GetIdentityCenterInstanceMetadata Lambda calls SSO Admin
ListInstances (target prefix SWBExternalService., the service's AWS-internal
codename, cf. config's StarlingDoveService) and requires exactly one instance
with InstanceArn and IdentityStoreId. Previously no descriptor matched the
target, so the call died with UnknownOperationException. Identifiers are
fixed constants so they survive restarts — LZA persists them into SSM
parameters between stages.
* fix(config): declare ssoadmin enabled toggle in both application.yml files
Upstream's ServiceConfigYamlCoverageTest requires every service config with an
enabled() toggle to declare it explicitly in both files; this branch predates
that test and fails it without the declaration.
* docs(ssoadmin): defer the single-op handler from action-table generation
* docs(ssoadmin): alias the sso descriptor to the IAM page
* fix(ssoadmin): report the caller's account as OwnerAccountId and assert the unsupported-operation error type
* fix(ssoadmin): use UnknownOperationException for unrecognized actions
Matches this codebase's JSON 1.1 dispatch convention (ServiceQuotas, Network
Firewall, and others already use it) and is a real modelled shape unlike the
bare UnsupportedOperation string, which has no Exception suffix and isn't in
sso-admin's error model.
* docs: correct service count to 79 after the #2579 merge
The upstream/main merge (8a4d9bd1b) added two new services
(servicequotas, ram) on top of this branch's own sso-admin
addition. The merge-base count was 76; three disjoint new services
(1 ours + 2 upstream) makes 79, not 78 as the merge commit left it.
This commit is contained in:
1 parent
47034394d1
commit
a2bd22d5f8
13 files changed
+190
-4
No files matched your search
@@ -178,7 +178,7 @@ LocalStack's community edition [sunset in March 2026](https://blog.localstack.cl
|
||||
| CodeBuild | Real Docker execution | No |
|
||||
| Native binary | ~40 MB | No |
|
||||
|
||||
**78 AWS services. Broad coverage. Free forever.**
|
||||
**79 AWS services. Broad coverage. Free forever.**
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ Floci is a fast, free, and open-source local AWS service emulator built for deve
|
||||
|
||||
## Supported Services
|
||||
|
||||
Floci emulates 78 AWS services. See the [Services Overview](services/index.md) for per-service operation counts, endpoints, and full protocol details.
|
||||
Floci emulates 79 AWS services. See the [Services Overview](services/index.md) for per-service operation counts, endpoints, and full protocol details.
|
||||
|
||||
| Service | Protocol |
|
||||
|---|---|
|
||||
@@ -117,7 +117,7 @@ docker compose up -d
|
||||
aws --endpoint-url http://localhost:4566 s3 mb s3://my-bucket
|
||||
```
|
||||
|
||||
All 78 AWS services are immediately available at `http://localhost:4566`.
|
||||
All 79 AWS services are immediately available at `http://localhost:4566`.
|
||||
|
||||
[Get started →](getting-started/quick-start.md){ .md-button .md-button--primary }
|
||||
[View services →](services/index.md){ .md-button }
|
||||
@@ -1,6 +1,6 @@
|
||||
# Services Overview
|
||||
|
||||
Floci emulates 78 AWS services on a single port (`4566`). All services use the real AWS wire protocol, your existing AWS CLI commands and SDK clients work without modification.
|
||||
Floci emulates 79 AWS services on a single port (`4566`). All services use the real AWS wire protocol, your existing AWS CLI commands and SDK clients work without modification.
|
||||
|
||||
This page is the canonical reference for supported service and operation counts. Some services expose separate control-plane and data-plane rows below. Other docs (and the README) should link here rather than duplicating the table.
|
||||
|
||||
|
||||
@@ -672,6 +672,7 @@ public interface EmulatorConfig {
|
||||
RumServiceConfig rum();
|
||||
GuardDutyServiceConfig guardduty();
|
||||
EmrServerlessServiceConfig emrserverless();
|
||||
SsoAdminServiceConfig ssoadmin();
|
||||
ServiceQuotasServiceConfig servicequotas();
|
||||
RamServiceConfig ram();
|
||||
ControlTowerServiceConfig controltower();
|
||||
@@ -679,6 +680,11 @@ public interface EmulatorConfig {
|
||||
EfsServiceConfig efs();
|
||||
}
|
||||
|
||||
interface SsoAdminServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
}
|
||||
|
||||
interface IotServiceConfig {
|
||||
@WithDefault("true")
|
||||
boolean enabled();
|
||||
|
||||
@@ -23,6 +23,7 @@ import io.github.hectorvent.floci.services.ce.CostExplorerJsonHandler;
|
||||
import io.github.hectorvent.floci.services.cloudtrail.CloudTrailJsonHandler;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.ApplicationAutoScalingJsonHandler;
|
||||
import io.github.hectorvent.floci.services.cloudcontrol.CloudControlJsonHandler;
|
||||
import io.github.hectorvent.floci.services.ssoadmin.SsoAdminJsonHandler;
|
||||
import io.github.hectorvent.floci.services.configservice.ConfigServiceJsonHandler;
|
||||
import io.github.hectorvent.floci.services.cur.CurJsonHandler;
|
||||
import io.github.hectorvent.floci.services.pricing.PricingJsonHandler;
|
||||
@@ -108,6 +109,7 @@ public class AwsJson11Controller {
|
||||
private final ApplicationAutoScalingJsonHandler applicationAutoScalingJsonHandler;
|
||||
private final CloudHsmV2JsonHandler cloudHsmV2JsonHandler;
|
||||
private final OrganizationsJsonHandler organizationsJsonHandler;
|
||||
private final SsoAdminJsonHandler ssoAdminJsonHandler;
|
||||
private final ServiceQuotasJsonHandler serviceQuotasJsonHandler;
|
||||
|
||||
@Inject
|
||||
@@ -147,6 +149,7 @@ public class AwsJson11Controller {
|
||||
ApplicationAutoScalingJsonHandler applicationAutoScalingJsonHandler,
|
||||
CloudHsmV2JsonHandler cloudHsmV2JsonHandler,
|
||||
OrganizationsJsonHandler organizationsJsonHandler,
|
||||
SsoAdminJsonHandler ssoAdminJsonHandler,
|
||||
ServiceQuotasJsonHandler serviceQuotasJsonHandler) {
|
||||
this.objectMapper = objectMapper;
|
||||
this.strictBodyReader = objectMapper.reader().with(DeserializationFeature.FAIL_ON_TRAILING_TOKENS);
|
||||
@@ -190,6 +193,7 @@ public class AwsJson11Controller {
|
||||
this.applicationAutoScalingJsonHandler = applicationAutoScalingJsonHandler;
|
||||
this.cloudHsmV2JsonHandler = cloudHsmV2JsonHandler;
|
||||
this.organizationsJsonHandler = organizationsJsonHandler;
|
||||
this.ssoAdminJsonHandler = ssoAdminJsonHandler;
|
||||
this.serviceQuotasJsonHandler = serviceQuotasJsonHandler;
|
||||
}
|
||||
|
||||
@@ -267,6 +271,7 @@ public class AwsJson11Controller {
|
||||
// action is authorized against the calling account, so pass that instead of region.
|
||||
case "organizations" ->
|
||||
organizationsJsonHandler.handle(action, request, regionResolver.getAccountId());
|
||||
case "sso" -> ssoAdminJsonHandler.handle(action, request, regionResolver.getAccountId());
|
||||
case "servicequotas" -> serviceQuotasJsonHandler.handle(
|
||||
action, request, region, regionResolver.getAccountId());
|
||||
default -> null;
|
||||
|
||||
@@ -385,6 +385,13 @@ public class ResolvedServiceCatalog {
|
||||
null, null, 5000L, null, ServiceProtocol.JSON,
|
||||
protocols(ServiceProtocol.JSON),
|
||||
Set.of("CloudApiService."), Set.of("cloudcontrolapi"), Set.of(), Set.of()),
|
||||
// SSO Admin (IAM Identity Center) signs with scope "sso"; its Smithy target
|
||||
// prefix is the AWS-internal codename SWBExternalService (cf. config's
|
||||
// StarlingDoveService above).
|
||||
descriptor("sso", "ssoadmin", config.services().ssoadmin().enabled(), true,
|
||||
null, null, 5000L, null, ServiceProtocol.JSON,
|
||||
protocols(ServiceProtocol.JSON),
|
||||
Set.of("SWBExternalService."), Set.of("sso"), Set.of(), Set.of()),
|
||||
descriptor("autoscaling", "autoscaling", config.services().autoscaling().enabled(), true,
|
||||
"autoscaling", config.storage().mode(), 5000L, AwsNamespaces.AUTOSCALING, ServiceProtocol.QUERY,
|
||||
protocols(ServiceProtocol.QUERY),
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.github.hectorvent.floci.services.ssoadmin;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
@ApplicationScoped
|
||||
public class SsoAdminJsonHandler {
|
||||
|
||||
private final SsoAdminService service;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
public SsoAdminJsonHandler(SsoAdminService service, ObjectMapper mapper) {
|
||||
this.service = service;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
public Response handle(String action, JsonNode request, String callerAccountId) {
|
||||
return switch (action) {
|
||||
case "ListInstances" -> listInstances(callerAccountId);
|
||||
default -> throw new AwsException("UnknownOperationException",
|
||||
"Operation " + action + " is not supported.", 400);
|
||||
};
|
||||
}
|
||||
|
||||
private Response listInstances(String callerAccountId) {
|
||||
ObjectNode response = mapper.createObjectNode();
|
||||
ObjectNode instance = response.putArray("Instances").addObject();
|
||||
instance.put("InstanceArn", service.getInstanceArn());
|
||||
instance.put("IdentityStoreId", service.getIdentityStoreId());
|
||||
instance.put("Name", "floci-identity-center");
|
||||
instance.put("OwnerAccountId", callerAccountId);
|
||||
instance.put("Status", "ACTIVE");
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.github.hectorvent.floci.services.ssoadmin;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* IAM Identity Center (SSO Admin) business logic.
|
||||
*
|
||||
* <p>Models the single organization Identity Center instance LZA's
|
||||
* Custom::GetIdentityCenterInstanceMetadata Lambda expects: its {@code ListInstances} call
|
||||
* succeeds only when exactly one instance is returned, carrying both {@code InstanceArn} and
|
||||
* {@code IdentityStoreId}. The identifiers are fixed so they stay stable across calls and
|
||||
* container restarts — LZA persists them into SSM parameters between stages.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class SsoAdminService {
|
||||
|
||||
private static final String INSTANCE_ARN = "arn:aws:sso:::instance/ssoins-7223b02a5d9f7c8e";
|
||||
private static final String IDENTITY_STORE_ID = "d-9067f2a3c1";
|
||||
|
||||
public String getInstanceArn() {
|
||||
return INSTANCE_ARN;
|
||||
}
|
||||
|
||||
public String getIdentityStoreId() {
|
||||
return IDENTITY_STORE_ID;
|
||||
}
|
||||
}
|
||||
@@ -547,6 +547,8 @@ floci:
|
||||
enabled: true
|
||||
emrserverless:
|
||||
enabled: true
|
||||
ssoadmin:
|
||||
enabled: true
|
||||
controltower:
|
||||
enabled: true
|
||||
lakeformation:
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package io.github.hectorvent.floci.services.ssoadmin;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.matchesPattern;
|
||||
|
||||
/**
|
||||
* IAM Identity Center (SSO Admin, target prefix {@code SWBExternalService.}).
|
||||
*
|
||||
* <p>LZA's Custom::GetIdentityCenterInstanceMetadata Lambda calls {@code ListInstances} and
|
||||
* requires exactly one instance carrying {@code InstanceArn} and {@code IdentityStoreId}.
|
||||
*/
|
||||
@QuarkusTest
|
||||
class SsoAdminIntegrationTest {
|
||||
|
||||
private static final String AUTH_HEADER =
|
||||
"AWS4-HMAC-SHA256 Credential=AKID/20260101/us-east-1/sso/aws4_request";
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void listInstances_returnsExactlyOneInstanceWithArnAndIdentityStore() {
|
||||
given()
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.header("X-Amz-Target", "SWBExternalService.ListInstances")
|
||||
.body("{}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Instances.size()", equalTo(1))
|
||||
.body("Instances[0].InstanceArn", matchesPattern("arn:aws:sso:::instance/ssoins-[0-9a-f]{16}"))
|
||||
.body("Instances[0].IdentityStoreId", matchesPattern("d-[0-9a-f]{10}"))
|
||||
.body("Instances[0].Status", equalTo("ACTIVE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void listInstances_isStableAcrossCalls() {
|
||||
String firstArn = listInstancesArn();
|
||||
String secondArn = listInstancesArn();
|
||||
org.junit.jupiter.api.Assertions.assertEquals(firstArn, secondArn);
|
||||
}
|
||||
|
||||
@Test
|
||||
void unknownAction_returnsUnknownOperationException() {
|
||||
given()
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.header("X-Amz-Target", "SWBExternalService.DescribeInstance")
|
||||
.body("{}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", org.hamcrest.Matchers.containsString("UnknownOperationException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void listInstances_ownerAccountIdTracksTheCaller() {
|
||||
given()
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.header("Authorization",
|
||||
"AWS4-HMAC-SHA256 Credential=111122223333/20260101/us-east-1/sso/aws4_request")
|
||||
.header("X-Amz-Target", "SWBExternalService.ListInstances")
|
||||
.body("{}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Instances[0].OwnerAccountId", org.hamcrest.Matchers.equalTo("111122223333"));
|
||||
}
|
||||
|
||||
private static String listInstancesArn() {
|
||||
return given()
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.header("Authorization", AUTH_HEADER)
|
||||
.header("X-Amz-Target", "SWBExternalService.ListInstances")
|
||||
.body("{}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("Instances[0].InstanceArn");
|
||||
}
|
||||
}
|
||||
@@ -341,6 +341,8 @@ floci:
|
||||
enabled: true
|
||||
emrserverless:
|
||||
enabled: true
|
||||
ssoadmin:
|
||||
enabled: true
|
||||
controltower:
|
||||
enabled: true
|
||||
lakeformation:
|
||||
|
||||
@@ -20,6 +20,7 @@ aliases:
|
||||
kafka: msk # MSK's SigV4 signing name is "kafka"
|
||||
mq: amazonmq # Amazon MQ's SigV4 signing name is "mq"
|
||||
signin: iam # AWS Sign-In facet, at iam.md#aws-sign-in-login-credentials
|
||||
sso: iam # Identity Center ListInstances facet on the IAM page
|
||||
events: eventbridge
|
||||
servicediscovery: cloudmap # Cloud Map's SigV4 signing name
|
||||
elasticmapreduce: emr # EMR's SigV4 signing name
|
||||
|
||||
@@ -146,6 +146,7 @@ services:
|
||||
# Switch handlers that exist but are intentionally not yet covered (see reasons).
|
||||
# A NEW switch handler not listed here and not registered above fails `--strict`.
|
||||
deferred_handlers:
|
||||
- { path: src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminJsonHandler.java } # single-op Identity Center stub, no standalone doc page yet
|
||||
- { path: src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandler.java } # non-tabular doc (grouped/inline)
|
||||
- { path: src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java } # non-tabular doc (grouped/inline)
|
||||
- { path: src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsJsonHandler.java } # no standalone action table yet
|
||||
|
||||
Reference in new issue
Block a user