MVC 응용 프로그램에서 양식 인증을 사용하여 사용자를 인증 한 다음 System.IdentityModel.Services.SessionAuthenticationModule
세션을 지속합니다.MachineKeySessionSecurityTokenHandler 및 응용 프로그램 재시작 사이에 만료되는 세션 토큰
아직 필요한 시점이 아니기 때문에 응용 프로그램이 Dominick Baier here에 설명 된대로 웹 팜에 잘 살 수 있도록 System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler
을 활용하고 싶습니다.
내가 가진 문제는 machineKey 기반 처리에서 세션이 서버 시스템에서 시스템으로 유효 할뿐만 아니라 응용 프로그램이 다시 시작될 때까지 지속되어야한다는 것입니다. 그러나 브라우저를 사용하여 응용 프로그램을 다시 시작하거나 다시 작성하면 쿠키가 유효하지 않게되고 인증 화면으로 되돌아옵니다. 다시 인증되면 모든 것이 정상이며 세션이 유지됩니다. 그러나 다음에 앱이 다시 시작되거나 다시 빌드되면 다시 인증해야합니다.
나는 이것이 내가 얻지 못하는 WIF의 한 부분이라고 확신하지만, 여기서부터 어디로 갈 것인가를 모른다. 나는 MachineKeySessionSecurityTokenHandler
을 확장해야하는 것을 두려워하지 않지만 계속 진행하기 전에 여기에서 진행되는 것을 이해하고 있는지 확인하고 싶습니다. 나는 SessionSecurityTokenHandler
기본값이 암호화를 위해 응용 프로그램 풀의 일부 식별자와 함께 DPAPI를 사용한다는 것을 이해합니다. 따라서이 경우에 발생하지만, MachineKeySessionSecurityTokenHandler
의 동작은 저를 놀리는 것 같습니다. MachineKeySessionSecurityTokenHandler
에 의존하여 다시 시작할 때 다시 생성되는 응용 프로그램의 식별자가 있습니까? 방금 설정이 누락 되었습니까? 여기
<system.identityModel>
<identityConfiguration>
<securityTokenHandlers>
<remove type="System.IdentityModel.Tokens.SessionSecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add type="System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</securityTokenHandlers>
</identityConfiguration>
</system.identityModel>
...
<system.web>
<machineKey compatibilityMode="Framework45"
validationKey="E27893..."
decryptionKey="ABC..."
validation="SHA1" decryption="AES" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login"
timeout="10080" />
</authentication>
</system.web>
...
<configSections>
<section name="system.identityModel"
type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</configSections>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="SessionAuthenticationModule"
type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</modules>
</system.webServer>
크리스이 이동. 나는 지금 내가하고있는 일을 위해 일하는 것과 같은 것을 얻으려고 고심하고 있었고, 나는 내 web.configs에서 값을 얻고 있었다. web.config 설정을 게시 해 주셔서 감사 드리며,이 문제를 해결하는 데 도움이되었습니다. Mike –
@indiecodemonkey -이게 당신을 도왔다 고 행복합니다! –
폼 인증을 사용하지 않고 사용자를 인증하기 위해 SessionAuthenticationModule을 사용하는 경우 공유 WIF 캐싱 (예 : 앱 풀 재설정에 재설정되지 않음)을 구현하기 위해 마지막으로이 기능이 필요합니다. 그리고 그것은 SessionSecurityTokenCache입니다. MSDN에있는 예제는 https://msdn.microsoft.com/ko-kr/library/hh545457(v=vs.110).aspx –