浏览我的 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
我一直在对我的 cookie 进行更多测试,我可以看到,随着每个请求,我的 fedauth cookie 变得越来越大。这可能是问题的一部分或全部。最终,随机地添加了一些坏字符。令牌以这些结束标记“”结尾。我可以看到,当安全上下文令牌关闭标记后出现一些额外字符时,它会失败。每次错误发生时,额外的字符都不同。
弄清楚了。哎呀...程序员错误...
当用户首次登录我的应用程序时,我从数据库中提取一些角色信息并为他们创建声明。我每次都重新添加这些声明,所以我的会话令牌不断增长...不断增长...最终导致令牌分裂为 2、3、4、5、6 个 cookie,最终有些东西被卡住了这。我不再每次都添加声明。不再看到这个问题了。
感谢你的帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)