2017-09-21 6 views
6

J'applique une application AngularJS qui utilisera IdentityServer4 pour l'autorisation.AngularJS - IdentityServer4.Quickstart.UI - 'AuthenticationProperties' est une référence ambiguë

J'ai une application Angular autonome dans une application .Net Core 2.0 qui appelle le contrôleur api dans l'application de base. NET. si je navigue vers http://localhost:5050/.well-known/openid-configuration je reçois le json retourné.

Je l'ai utilisé this exemple comme base pour mon service auth:

function authService() { 

    var config = { 
     authority: "http://localhost:5050", 
     client_id: "js", 
     redirect_uri: "http://localhost:5050/LocalizationAdmin/callback.html", 
     response_type: "id_token token", 
     scope: "openid profile api1", 
     post_logout_redirect_uri: "http://localhost:5050/LocalizationAdmin/index.html" 
    }; 
    var mgr = new Oidc.UserManager(config); 

    mgr.getUser().then(function (user) { 
     if (user) { 
      log("User logged in", user.profile); 
     } else { 
      log("User not logged in"); 
     } 
    }); 

    var service = { 
     login: login, 
     logout: logout, 
    }; 
    return service; 

    function login() { 
     mgr.signinRedirect(); 
    } 

Dans callback.html J'ai ajouté:

<body> 
    <script src="scripts/oidc-client.js"></script> 
    <script> 
     new Oidc.UserManager().signinRedirectCallback().then(function() { 
      window.location = "index.html"; 
     }).catch(function (e) { 
      console.error(e); 
     }); 
    </script> 
</body> 

Il tente de rediriger vers:

http://localhost:5050/account/login?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Djs%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A5050%252FLocalizationAdmin%252Fcallback.html%26response_type%3Did_token%2520token%26scope%3Dopenid%2520profile%2520api1%26state%3Dd526351a26f74202badb7685022a6549%26nonce%3D6c858921378645ca8fcad973eb26cc72 

Cependant, je veux juste qu'il redirige vers le serveur de connexion IdentityServer4 een. Comment puis-je atteindre cet objectif? Toute aide appréciée.

Edit:

J'ai ajouté les modèles d'interface utilisateur à partir d'ici:

https://github.com/IdentityServer/IdentityServer4.Quickstart.UI

Mais je reçois un certain nombre d'erreurs, cela pourrait-être parce que je suis en utilisant .Net Core 2.0 Version: assemblyref://IdentityServer4 (2.0.0-rc1-update1)

Error CS0104 'AuthenticationProperties' is an ambiguous reference between 'Microsoft.AspNetCore.Authentication.AuthenticationProperties' and 'Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties'

Projet de démonstration montrant le problème ajouté à github here.

Répondre

2

Je ne sais pas à quel point c'est stable mais je viens d'utiliser la commande powershell pointant vers la branche dev et cela semble fonctionner.

iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/IdentityServer/IdentityServer4.Quickstart.UI/dev/get.ps1'))