2017-10-03 16 views
0

Si je crée une application dans "Application registration portal", seule la première URL de redirection fonctionne.Utilisation de plusieurs URL de redirection pour une application "Application Registration Portal"

Par exemple; si j'ajoute https://google.com/ d'abord, cette URL fonctionne. Mais si j'ajoute https://localhost/ ce n'est pas le cas. Lorsque j'ajoute https://localhost/ en premier et https://google.com/ en second lieu, seule l'URL localhost fonctionne.

La seule façon de tout faire fonctionner est de créer deux applications distinctes dans le "Portail d'enregistrement des applications". Un pour l'environnement de développement et un pour la production.

Pour moi, cela ressemble à un problème de cache côté serveur.

Répondre

-1

Résolu! J'ai oublié d'essayer la solution trouvée sur github, qui a résolu mon problème.

https://github.com/IdentityServer/IdentityServer3/issues/1458


MISE À JOUR

La méthode ConfigureAuth dans mes Startup.Auth.cs contient maintenant le code suivant:

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 

app.UseCookieAuthentication(new CookieAuthenticationOptions()); 

app.UseOpenIdConnectAuthentication(
    new OpenIdConnectAuthenticationOptions 
    { 
     ClientId = clientId, 
     Authority = Authority, 

     Notifications = new OpenIdConnectAuthenticationNotifications() 
     { 
      // If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away. 
      AuthorizationCodeReceived = (context) => 
      { 
       var code = context.Code; 
       ClientCredential credential = new ClientCredential(clientId, appKey); 
       string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value; 
       AuthenticationContext authContext = new AuthenticationContext(Authority, new ADALTokenCache(signedInUserID)); 
       AuthenticationResult result = authContext.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), credential, graphResourceId); 

       return Task.FromResult(0); 
      }, 

      RedirectToIdentityProvider = (context) => 
      { 
       context.ProtocolMessage.RedirectUri = redirectUri; 
       context.ProtocolMessage.PostLogoutRedirectUri = redirectUri; 

       return Task.FromResult(0); 
      } 
     }, 
    } 
); 

Note: Ce code est utilisé dans une application ASP.NET MVC qui utilise c l'authentification basée sur ookie.