1

我正在尝试使用 identityserver v3 后注销功能。

登录没问题,当我想注销时,我调用可以在从 (/.well-known/openid-configuration) 请求的发现文档中找到的“end_session_endpoint”端点,我将id_token_hintpost_logout_redirect_uri传递给它(根据this:注销端点

对于id_token_hint,我将我从登录阶段收到的 id_token 传递给它(我把它放在本地存储中)。对于post_logout_redirect_uri,我将为客户端配置的 uri 传递给它。

我可以在身份服务器的日志中看到语句:'结束结束会话请求'所以我认为到那时一切都好。

但我收到一个例外:

   idsrv3.vshost.exe Information: 0 : [Thinktecture.IdentityServer.Core.Endpoints.E
    ndSessionController]: 27/03/2015 14:36:09 +00:00 -- End end session request
    idsrv3.vshost.exe Information: 0 : [Thinktecture.IdentityServer.Core.Endpoints.E
    ndSessionController]: 27/03/2015 14:36:09 +00:00 -- End end session request
    idsrv3.vshost.exe Information: 0 : [Thinktecture.IdentityServer.Core.Results.Log
    outResult]: 27/03/2015 14:36:09 +00:00 -- Redirecting to logout page
    idsrv3.vshost.exe Information: 0 : [Thinktecture.IdentityServer.Core.Results.Log
    outResult]: 27/03/2015 14:36:09 +00:00 -- Redirecting to logout page
    idsrv3.vshost.exe Error: 0 : [Thinktecture.IdentityServer.Core.Configuration.Hos
    ting.LogProviderExceptionLogger]: 27/03/2015 14:36:12 +00:00 -- Unhandled except
    ion
    System.Exception: Illegal base64url string!
       at Thinktecture.IdentityModel.Base64Url.Decode(String arg) in c:\etc\Dropbox\
    thinktecture\IdentityModel\source\Core\Base64Url.cs:line 34
       at Thinktecture.IdentityServer.Core.Extensions.IDataProtectorExtensions.Unpro
    tect(IDataProtector protector, String data, String entropy) in c:\ballen\github\
    thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\Core\Extensions\IDataPro
    tectorExtensions.cs:line 52
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Unp
    rotect(String data, IDataProtector protector) in c:\ballen\github\thinktecture\I
    dSrv3\Thinktecture.IdentityServer3\source\Core\Configuration\Hosting\MessageCook
    ie.cs:line 81
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Unp
    rotect(String data) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identit
    yServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 125
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Rea
    dByCookieName(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.
    IdentityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 171
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Get
    CookieRank(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Ide
    ntityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 203
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.<Cl
    earOverflow>b__a(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktectu
    re.IdentityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 227
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
       at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Enumerable.<SkipIterator>d__4d`1.MoveNext()
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Cle
    arOverflow() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer
    3\source\Core\Configuration\Hosting\MessageCookie.cs:line 232
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Wri
    te(TMessage message) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identi
    tyServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 138
       at Thinktecture.IdentityServer.Core.Results.LogoutResult.Execute() in c:\ball
    en\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\Core\Results\L
    ogoutResult.cs:line 73
       at Thinktecture.IdentityServer.Core.Results.LogoutResult.ExecuteAsync(Cancell
    ationToken cancellationToken) in c:\ballen\github\thinktecture\IdSrv3\Thinktectu
    re.IdentityServer3\source\Core\Results\LogoutResult.cs:line 61
       at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncC
    ore>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identit
    yServer3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCor
    e>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityS
    erver3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCor
    e>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityS
    erver3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext
    () in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\C
    ore\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.
    MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\
    source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNe
    xt() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source
    \Core\Services\Default\DefaultConsentService.cs:line 0
    idsrv3.vshost.exe Error: 0 : [Thinktecture.IdentityServer.Core.Configuration.Hos
    ting.LogProviderExceptionLogger]: 27/03/2015 14:36:12 +00:00 -- Unhandled except
    ion
    System.Exception: Illegal base64url string!
       at Thinktecture.IdentityModel.Base64Url.Decode(String arg) in c:\etc\Dropbox\
    thinktecture\IdentityModel\source\Core\Base64Url.cs:line 34
       at Thinktecture.IdentityServer.Core.Extensions.IDataProtectorExtensions.Unpro
    tect(IDataProtector protector, String data, String entropy) in c:\ballen\github\
    thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\Core\Extensions\IDataPro
    tectorExtensions.cs:line 52
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Unp
    rotect(String data, IDataProtector protector) in c:\ballen\github\thinktecture\I
    dSrv3\Thinktecture.IdentityServer3\source\Core\Configuration\Hosting\MessageCook
    ie.cs:line 81
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Unp
    rotect(String data) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identit
    yServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 125
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Rea
    dByCookieName(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.
    IdentityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 171
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Get
    CookieRank(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Ide
    ntityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 203
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.<Cl
    earOverflow>b__a(String name) in c:\ballen\github\thinktecture\IdSrv3\Thinktectu
    re.IdentityServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 227
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
       at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Enumerable.<SkipIterator>d__4d`1.MoveNext()
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Cle
    arOverflow() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer
    3\source\Core\Configuration\Hosting\MessageCookie.cs:line 232
       at Thinktecture.IdentityServer.Core.Configuration.Hosting.MessageCookie`1.Wri
    te(TMessage message) in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identi
    tyServer3\source\Core\Configuration\Hosting\MessageCookie.cs:line 138
       at Thinktecture.IdentityServer.Core.Results.LogoutResult.Execute() in c:\ball
    en\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\Core\Results\L
    ogoutResult.cs:line 73
       at Thinktecture.IdentityServer.Core.Results.LogoutResult.ExecuteAsync(Cancell
    ationToken cancellationToken) in c:\ballen\github\thinktecture\IdSrv3\Thinktectu
    re.IdentityServer3\source\Core\Results\LogoutResult.cs:line 61
       at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncC
    ore>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.Identit
    yServer3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCor
    e>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityS
    erver3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d
    __5.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServ
    er3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCor
    e>d__0.MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityS
    erver3\source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext
    () in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source\C
    ore\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.
    MoveNext() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\
    source\Core\Services\Default\DefaultConsentService.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
    ification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNe
    xt() in c:\ballen\github\thinktecture\IdSrv3\Thinktecture.IdentityServer3\source
    \Core\Services\Default\DefaultConsentService.cs:line 0

这是我在 Client.cs 文件中的配置:

                PostLogoutRedirectUris = new List<string>
                {
                    "http://localhost:8000/demoApp/index.html"
                },

这是我发出的注销请求:

https://localhost:44333/connect/endsession?id_token_hint=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImEzck1VZ01Gdjl0UGNsTGE2eUYzekFrZnF1RSIsImtpZCI6ImEzck1VZ01Gdjl0UGNsTGE2eUYzekFrZnF1RSJ9.eyJub25jZSI6IjVkNzg0ODhhLTFlNWEtNGQyOC05Y2FhLTIxODUzYTdkNDQ0NSIsImlhdCI6MTQyNzQ2NTA5NCwiYXRfaGFzaCI6ImlIVG1NVGFFNVVmYWF1WFJaQ1pLdXciLCJzdWIiOiJJIGFtIHRoZSBTdWJqZWN0IiwiYW1yIjoicGFzc3dvcmQiLCJhdXRoX3RpbWUiOjE0Mjc0NjEwODksImlkcCI6Imlkc3J2IiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzMzMiLCJhdWQiOiJpbXBsaWNpdGNsaWVudCIsImV4cCI6MTQyNzQ2NTQ1NCwibmJmIjoxNDI3NDY1MDk0fQ.K5HmHf66sDBVuNT0YX3O_LPAcDnaF7iAeX_bssLdNKzwRDHEsYT0cergFJu8aglR25HUBRGb-wxSk-c7q0BIObdQArlOcH917w54FVlbsA8F8jAxnzq7eyK394TLEvFJMgrNktgzLWwV3NqOALGJ2aBo76wlLCDmSZjdulbbROP_tLNSKHNtUq8fcDodfvvfk1IKkxsUGW_1dqI2s3ZxaudoBQy_AZJbcaONEkQLxaoi4Z0b8lKDIgpwjjeSeAtryUc-K_dw6cfJLA3mePupJmFT2rHGo7aq81YJm0tai6qbHbCBKbX7gNaLSJ9t61Z0sGCX-dG_9YHk1crwfSTEdw&post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A8000%2FdemoApp%2Findex.html

在将其作为身份服务器上的问题发布之前,我想知道是否有人使用 javascript (angular) 中的隐式客户端实现了此功能。

4

1 回答 1

0

我只是做了

https://localhost:44333/connect/endsession

它从 cookie 中获得了会话。

于 2015-05-27T14:48:29.627 回答