Class OAuthTestClient
java.lang.Object
dev.relism.flash.ext.security.test.OAuthTestClient
An OAuth 2.1 client of the application under test, driving its own authorization server the way an MCP
client does: discovery (RFC 8414), registration (RFC 7591), authorization code with PKCE, consent, and
the token exchange. Its user signs in as any principal, through
TestSecurity.
OAuthTestClient.Tokens tokens = OAuthTestClient.register(app).authorize(() -> "alice");
app.request().with(tokens.bearer()).post("/mcp");
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat the exchange returned. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhere the authorization server sends the code: never contacted, only read off the redirect. -
Method Summary
Modifier and TypeMethodDescriptionauthorize(dev.relism.flash.ext.security.Principal user) Signs in asuser, allows this client if asked to, and exchanges the code: the application's default resource and no scope.The same, with extra authorization request parameters —scope,resource.clientId()Trades a refresh token for a new pair.static OAuthTestClientregister(dev.relism.flash.testing.FlashTest app) A public client, registered at the server's registration endpoint, allowed refresh tokens.
-
Field Details
-
REDIRECT_URI
Where the authorization server sends the code: never contacted, only read off the redirect.- See Also:
-
-
Method Details
-
register
A public client, registered at the server's registration endpoint, allowed refresh tokens. -
clientId
-
authorize
Signs in asuser, allows this client if asked to, and exchanges the code: the application's default resource and no scope. -
authorize
public OAuthTestClient.Tokens authorize(dev.relism.flash.ext.security.Principal user, Map<String, String> parameters) The same, with extra authorization request parameters —scope,resource. -
refresh
Trades a refresh token for a new pair.
-