private String obtainMatchingRedirect(Set<String> redirectUris, String requestedRedirect) {
        Assert.notEmpty(redirectUris, "Redirect URIs cannot be empty");

        if (redirectUris.size() == 1 && requestedRedirect == null) {
            return redirectUris.iterator().next();
        }
        for (String redirectUri : redirectUris) {
            if (requestedRedirect != null && redirectMatches(requestedRedirect, redirectUri)) {
                return requestedRedirect;
            }
        }
        throw new RedirectMismatchException("Invalid redirect: " + requestedRedirect
                + " does not match one of the registered values: " + redirectUris.toString());
    }
private String obtainMatchingRedirect ( Set < String > redirectUris , String requestedRedirect ) { Assert . notEmpty ( redirectUris , "Redirect URIs cannot be empty" ) ; if ( redirectUris . size ( ) == 1 && requestedRedirect == null ) { return redirectUris . iterator ( ) . next ( ) ; } for ( String redirectUri : redirectUris ) { if ( requestedRedirect != null && redirectMatches ( requestedRedirect , redirectUri ) ) { return requestedRedirect ; } } throw new RedirectMismatchException ( "Invalid redirect: " + requestedRedirect + " does not match one of the registered values: " + redirectUris . toString ( ) ) ; }
Attempt to match one of the registered URIs to the that of the requested one.

@param redirectUris the set of the registered URIs to try and find a match. This cannot be null or empty.
@param requestedRedirect the URI used as part of the request
@return the matching URI
@throws RedirectMismatchException if no match was found