-
Notifications
You must be signed in to change notification settings - Fork 7
JCL-444: Improve support for RFC 9207 #1246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,6 +211,13 @@ ErrorResponse tryParseError(final InputStream input) { | |
| } | ||
|
|
||
| private Request tokenRequest(final Metadata metadata, final TokenRequest request) { | ||
| if (request.getIssuer() != null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the Issuer required to be in the request? Is it ok to ignore if null?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that's the case is there a missing
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In short, we need that additional Now I recall how all this fits together in the context of a web application: // Intialize the OAuth2 authorization code flow
@GET
@Path("/login")
public CompletionStage<Response> login() {
var client = new OpenIdProvider(issuer, dpop);
var request = AuthorizationRequest.newBuilder()
.scope("openid")
.scope("webid")
.build(config.clientId, config.redirectUri);
// Redirect the client to the authorization endpoint
return client.authorize(request).thenApply(Response::seeOther);
}Then, the response gets processed in the following way: // Continue the OAuth2 authorization code flow
// The client will receive a URL such as /callback?code=123456&iss=https://op.example
@GET
@Path("/callback")
public CompletionStage<Response> callback(@QueryParam("code") String code, @QueryParam("iss") String issuer) {
var client = new OpenIdProvider(issuer, dpop);
var request = TokenRequest.newBuilder()
.code(code)
.issuer(issuer)
.build("authorization_code", config.clientId);
return client.token(request)
.thenApply(token -> {
// store or process token.idToken
// set a session cookie for the application
// redirect the user to a landing page (e.g. /profile)
return Response.seeOther(URI.create("/profile"));
});
}In this flow, setting
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spec gives some guidance as a SHOULD:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. f00802e adjusts the conditional logic. The existing integration tests cover the case where |
||
| if (!request.getIssuer().equals(metadata.issuer)) { | ||
| throw new OpenIdException("Issuer mismatch. " + | ||
| "Please verify that the designated OpenID issuer is correct"); | ||
| } | ||
| } | ||
|
|
||
| if (!metadata.grantTypesSupported.contains(request.getGrantType())) { | ||
| throw new OpenIdException("Grant type [" + request.getGrantType() + "] is not supported by this provider."); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.