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


// If the 'redirect_uri' is not contained in the request.
if ( redirectUri == null )
{
// The 'redirect_uri' parameter is mandatory in
// OpenID Connect. It's optional in RFC 6749.
throw new Exception(
\"The 'redirect_uri' parameter is missing.\");

// For each registered redirect URI.
for ( registeredRedirectUri : registeredRedirectUris )
{
// 'Simple String Comparison' is required by the
// specification.
if ( registeredRedirectUri.equals( redirectUri ) )
{
// OK. The redirect URI specified by the
// authorization request is registered.
registered = true;
break;


// If the redirect URI specified by the authorization
// request matches none of the registered redirect URIs.
if ( registered == false )
{
throw new Exception(
\"The redirect URI is not registered.\");


else
{
// Check requirements by RFC 6749.
// If redirect URIs are not registered at all.
if ( registeredRedirectUris.size() == 0 )

推荐阅读