fe-authentication-api defines the core authentication data model used by protocol adapters, handler orchestration, and plugins.
This module intentionally stays small and stable:
Subject/Identity are deprecated and removed)AuthenticationRequestProtocol-agnostic authentication input.
AuthenticationRequest request = AuthenticationRequest.builder() .username("alice") .credentialType(CredentialType.CLEAR_TEXT_PASSWORD) .credential("password123".getBytes(StandardCharsets.UTF_8)) .remoteHost("192.168.1.100") .remotePort(9030) .clientType("mysql") .property("trace_id", "req-123") .build();
Key fields:
usernamecredentialTypecredentialremoteHost / remotePortclientTypepropertiesPrincipal and BasicPrincipalAuthentication output identity contract.
Principal principal = BasicPrincipal.builder() .name("alice") .authenticator("corp_ldap") .externalPrincipal("uid=alice,ou=users,dc=example,dc=com") .addExternalGroup("developers") .attribute("email", "alice@example.com") .build();
Copy from existing principal:
Principal updated = BasicPrincipal.builder(principal) .attribute("department", "data") .build();
AuthenticationResultAuthentication result is state-driven:
SUCCESSCONTINUEFAILUREAuthenticationResult ok = AuthenticationResult.success(principal); AuthenticationResult needMore = AuthenticationResult.continueWith(state, challenge); AuthenticationResult failed = AuthenticationResult.failure("Invalid credential");
AuthenticationIntegrationA named auth configuration instance.
AuthenticationIntegration integration = AuthenticationIntegration.builder() .name("corp_ldap") .type("ldap") .property("server", "ldap://ldap.example.com:389") .property("base_dn", "dc=example,dc=com") .comment("Corporate LDAP") .build();
AuthenticationBindingUser-to-integration binding model.
AuthenticationBinding binding = AuthenticationBinding.forUser("alice", "corp_ldap");
CredentialTypeBuilt-in credential type constants (string-based, extensible):
MYSQL_NATIVE_PASSWORDCLEAR_TEXT_PASSWORDKERBEROS_TOKENOAUTH_TOKENOIDC_ID_TOKENX509_CERTIFICATEJWT_TOKENSAML_ASSERTIONAuthenticationExceptionAuthentication failure reason object.
Use it in two ways:
AuthenticationResult.failure(...)byte[] fields are carried as-is by design; treat them as sensitive and short-lived.cd fe-authentication-api mvn test