Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volo.abp.IdentityServer can't work in implicit or Hybrid #1097

Closed
marjezhang opened this issue May 6, 2019 · 7 comments
Closed

volo.abp.IdentityServer can't work in implicit or Hybrid #1097

marjezhang opened this issue May 6, 2019 · 7 comments
Assignees

Comments

@marjezhang
Copy link

marjezhang commented May 6, 2019

excuse, this problem always have been right there. May be it is Abp.IdentityServer bug.
Beacause I use simple project only with IdentityServer4's Demo to run. The result is Success.
but i use project with volo.abp.IdentityServer's Template to run. The result is fault.

My enviremnet following:

IdentitServer: volo.Abp's Template in abp.io for Creating Style: without UI

TestClient: aspnetcore.Mvc
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System.IdentityModel.Tokens.Jwt;

The Problem is Implicit Or Hybrid can't work.
when i click the link in mvc's web ,then it return url like this, but page is wrong
image

Request URL: http://localhost:5000/connect/authorize?client_id=Mvc-Testclient&redirect_uri=http%3A%2F%2Flocalhost%3A5002%2Fsignin-oidc&response_type=code&scope=openid%20profile%20api1%20api2%20roles%20offline_access&response_mode=form_post&nonce=636927436848344986.YzY2YjZlYjMtM2I1Ni00MDUzLWFiNWYtYmY2YTA1NmNjMDUxYzkzMGEzNjMtNjE0NS00YmE1LThlMDctMjE2ZTZjYWFjOWI0&state=CfDJ8FO3MMSAAqxJvl2_YhgYlncxnAmAZqqAaqgagYuMagW6WsyeR6G_Odw5qjdMNrd_GI7vINLKaNgnAIyygQe4gchBor0AbaovFMiFbDQHKSzGB6vAsb3hBnjbPUKehDPMF4Rm0Jiqn8-THGPSk033ospZYM_afDCnEXkgUNYXbmPSlK6dLvJVQDTd9HEwGimG46WWzVeIfaKuubO-2CjqnmQLXd-RgFtz0OgmBJThJi1CLY84RkgtuDLKkRRwOEDqgCYmCrSvn6s77RYO1g-KP09JaO2cEiEKcyWDmriY2Z6LJhWRdezeDJUiShqxV4pIi2GCLyVf7AVquJar7Ao_j0E&x-client-SKU=ID_NETSTANDARD1_4&x-client-ver=5.2.0.0

The Identityserver DataSeed Client is right, like :


var client = new Client(
                Guid.NewGuid(),
                "Mvc-Testclient"
            )
            {
                ClientName = "Mvc-Testclient",
                ProtocolType = "oidc",
                Description = "test-client",
                AlwaysSendClientClaims = true,
                AlwaysIncludeUserClaimsInIdToken = true,
                AllowOfflineAccess = true,
                SlidingRefreshTokenLifetime = 3600,
                AccessTokenLifetime = 1800,
                RefreshTokenExpiration = (int)TokenExpiration.Sliding,
                AbsoluteRefreshTokenLifetime = 31536000 //365 days
                
            };

            client.AddScope("api1");
            client.AddScope("api2");
            client.AddScope("roles");
            client.AddScope(IdentityServerConstants.StandardScopes.OpenId);
            client.AddScope(IdentityServerConstants.StandardScopes.Profile);
            client.AddScope(IdentityServerConstants.StandardScopes
                .OfflineAccess);

            client.AddScope("unique_name");
            client.AddClaim("client1", "ClientClaimType1");
            client.AddClaim("client2", "ClientClaimType2");

            client.AddGrantType(GrantType.Hybrid);

            client.AddSecret("abc".Sha256());

            client.AddRedirectUri("http://localhost:5002/signin-oidc");
            client.AddPostLogoutRedirectUri(
                "http://localhost:5002/signout-callback-oidc");
            client.AddCorsOrigin("http://localhost:5002"); 


            await _clientRepository.InsertAsync(client);


@maliming
Copy link
Member

maliming commented May 7, 2019

@marjezhang
Can you provide a project to reproduce this problem?

@marjezhang
Copy link
Author

https://github.com/marjezhang/AbpIdentityServerTest.git

Here is my uploaded code, can you help me find the probelm????

File : IfcaIdentityServerHost.sln is solution From abp.io creating
Folder : TestCase , there are client for testing and original identityserver4 's demo

@marjezhang
Copy link
Author

@marjezhang
Can you provide a project to reproduce this problem?

https://github.com/marjezhang/AbpIdentityServerTest.git

Here is my uploaded code, can you help me find the probelm????

File : IfcaIdentityServerHost.sln is solution From abp.io creating
Folder : TestCase , there are client for testing and original identityserver4 's demo

@maliming
Copy link
Member

maliming commented May 7, 2019

Thanks, I will check your code.

@maliming maliming self-assigned this May 7, 2019
@marjezhang
Copy link
Author

@maliming Are there some problems in my code????

@maliming
Copy link
Member

maliming commented May 8, 2019

I see a lot of projects in AbpIdentityServerTest. Can you provide steps to reproduce your problem?

@marjezhang
Copy link
Author

  1. Db need to be Created in sqlserver with IdentityServerHost project
    you need to ensure the "mvc" client is hybrid of grandtype in this time.
  2. I run the IdentityServerHost project if there are not problem. But it will be right.
  3. And then i run the mvcclient project in the folder of TestCase/Client/MvcClient/, here will be fine too.
  4. I click the link of "Secret" in webbrowser when the project of MvcClient successful was running.
    It would be go to the lognin page, because it's not sigined.
    The problem would be disappeared. It would be not goto login page instead of disappeare unauthorize wrong tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants