AuthorizationSuccessResponse does not support query params in the redirect URI

Issue #145 duplicate
Hank DeDona created an issue

When the redirect URI has a query param in it, the AuthorizationSuccessResponse's toURI method just adds another ?code=xxxxxxxxxx to it, which means the redirect URI now has 2 question marks in it. Since section 3.1.2 of the OAuth 2 spec states that query parameters must be supported in the redirect URI, this kinda blocks us. I've temporarily worked around it by extending the AuthorizationSuccessResponse class and overriding the toURI() method with the following code:

@Override public URI toURI() throws SerializeException { UriBuilder urib = UriBuilder.fromUri(getRedirectionURI());

    // Add query params
    Map<String, String> params = toParameters();
    for (Entry<String, String> param : params.entrySet()) {
        urib.queryParam(param.getKey(), param.getValue());
    }

    return urib.build();
}

Comments (6)

  1. Connect2id OSS
    • changed status to open

    Thanks for reporting this. We'll add a test to confirm the bug and then proceed with the fix.

  2. Log in to comment