「应用安全」OAuth和OpenID Connect的全面比较(28)


if ( redirectUri == null )
{
// If redirect URIs are not registered at all
// or if multiple redirect URIs are registered.
if ( registeredRedirectUris.size() != 1 )
{
// A redirect URI must be explicitly specified
// by the 'redirect_uri' parameter.
throw new Exception(
\"The 'redirect_uri' parameter is missing.\");

// One redirect URI is registered. Use it as the
// default value of redirect URI.
redirectUri = registeredRedirectUris[0
;

// The authorization request contains the 'redirect_uri'
// parameter but redirect URIs are not registered.
else if ( registeredRedirectUris.size() == 0 )
{
// The code flow reaches here if and only if the
// client type is 'confidential' and the authorization
// flow is not 'Implicit Flow'. In this case the
// redirect URI specified by the 'redirect_uri'
// parameter of the authorization request is used
// although it is not registered. However
// requirements written in RFC 6749 3.1.2.

推荐阅读