Identityserver v3 post logout功能会抛出异常'Illegal base64url string!'

时间:2015-03-27 14:31:44

标签: javascript openid thinktecture-ident-server identityserver3

我正在尝试使用identityserver v3 post logout功能。

登录正常,当我要退出时,我调用'end_session_endpoint'端点,该端点可以在(/.well-known/openid-configuration)请求的发现文档中找到 我传递了 id_token_hint post_logout_redirect_uri (根据这个:logout endpoint

对于 id_token_hint 我传递了我从登录阶段收到的id_token(我把它放在localstorage中)。对于 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)中的隐式客户端实现了此功能。

1 个答案:

答案 0 :(得分:0)

我只是做了

https://localhost:44333/connect/endsession

它从cookie获得了会话。