2017-09-21 32 views
6

Wdrażam aplikację AngularJS, która będzie używać IdentityServer4 do autoryzacji.AngularJS - IdentityServer4.Quickstart.UI - 'AuthenticationProperties' jest niejednoznacznym odnośnikiem

Mam samodzielną aplikację kątową w aplikacji .Net Core 2.0, która wywołuje kontroler api w głównej aplikacji .net. jeśli przejdę na numer http://localhost:5050/.well-known/openid-configuration, otrzymuję jsona.

Użyłem this przykład jako podstawa do mojego usługi logowania:

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

W callback.html Dodałem:

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

Jest próbuje przekierować do:

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 

Jednak po prostu chcę, aby przekierować do serwera tożsamości IdentityServer4 een. Jak mogę to osiągnąć? Każda pomoc doceniona.

Edit:

Dodałem szablony UI stąd:

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

Ale otrzymuję wiele błędów, to może być bo używam .NET 2.0 Rdzeń wersja: 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'

Projekt demonstracyjny pokazujący problem dodany do github here.

Odpowiedz

2

Nie mam pojęcia, jak stabilne jest to, ale po prostu użyłem polecenia powershell wskazując na gałąź dev i wydaje się, że działa.

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

Powiązane problemy