2017-09-21 4 views
6

Ich bin ein AngularJS App implementieren, die IdentityServer4 für Autorisierung verwenden.AngularJS - IdentityServer4.Quickstart.UI - ‚AuthenticationProperties‘ ist eine mehrdeutige Referenz

Ich habe einen Stand-alone-Angular App in einer .NET-Core 2.0-Anwendung, die die api-Controller in der .net Kern App aufruft. Wenn ich zu http://localhost:5050/.well-known/openid-configuration blättern werde, bekomme ich den JSON zurück.

Ich habe this Beispiel als Grundlage für meine auth-Dienst verwendet:

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(); 
    } 

In callback.html ich hinzugefügt haben:

<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> 

Es zu umleiten versucht:

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 

Allerdings möchte ich nur, dass es zum IdentityServer4 login scr umleitet een. Wie kann ich das erreichen? Jede Hilfe wird geschätzt.

Edit:

ich die UI-Vorlagen von hier hinzugefügt haben:

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

Aber ich eine Reihe von Fehlern bekommen, dies sein könnte, weil ich .Net-Core bin mit 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'

Demo-Projekt, das das Problem zu Github here hinzugefügt zeigt.

Antwort

2

Ich habe keine Ahnung, wie stabil das ist, aber ich habe nur den Powershell-Befehl verwendet, der auf den Dev-Zweig zeigt, und es scheint zu funktionieren.

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

Verwandte Themen