Ben*_*man 6 c# asp.net-mvc azure wif
浏览我的mvc3 azure web角色时,我随机得到一个base 64编码错误.我正在使用带有被动身份验证的WIF来对我的ADFS服务器进行身份验证.我无法隔离它的来源,但我有一个想法,我希望得到一些反馈/帮助.
从调用堆栈看起来它来自一个糟糕的cookie.当我从chrome开发者控制台查看我的cookie时,来自wif/adfs的"FedAuth"cookie是唯一出现的.所以我想这些cookie已经被破坏或者其中包含无效字符.我正在努力验证这一点,但由于错误是随机发生的,所以需要一些时间.有没有人经历过类似的事情,或者有什么倾向可能导致这种情况?任何帮助表示赞赏!
这是一个例外:
The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.
[FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. ]
System.Convert.FromBase64String(String s) +0
Microsoft.IdentityModel.Web.ChunkedCookieHandler.ReadInternal(String name, HttpCookieCollection requestCookies) +613
Microsoft.IdentityModel.Web.ChunkedCookieHandler.ReadCore(String name, HttpContext context) +174
Microsoft.IdentityModel.Web.CookieHandler.Read(String name, HttpContext context) +133
Microsoft.IdentityModel.Web.CookieHandler.Read(HttpContext context) +59
Microsoft.IdentityModel.Web.CookieHandler.Read() +65
Microsoft.IdentityModel.Web.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +84
Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +119
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Run Code Online (Sandbox Code Playgroud)
我一直在对我的cookie进行更多测试,我可以看到每次请求我的fedauth cookie变得越来越大.这可能是部分或全部问题.最终,随机的东西会附加一些不好的字符.令牌以这些关闭标签""结束.我可以看到,在安全上下文令牌关闭标记之后出现一些额外字符时,它会失败.每次发生错误时,额外的字符都不同.
弄清楚了。哎呀...程序员错误...
当用户首次登录我的应用程序时,我从数据库中提取一些角色信息并为他们创建声明。我每次都重新添加这些声明,所以我的会话令牌不断增长...不断增长...最终导致令牌分裂为 2、3、4、5、6 个 cookie,最终有些东西被卡住了这。我不再每次都添加声明。不再看到这个问题了。
感谢你的帮助。