简体   繁体   中英

How to genreate a sts claim with default values for development and testing

We a have asp.net webform application where we use STS claims to manage user authorization. The workflow is pretty straight forward. User hits a login page enters credentials, a claim is generated which contains their rights. This claim is used to pass rights to our applications WCF service to control what data they have access to etc. For automated testing (and even development) I would like to setup a mechanism where the automated test bypasses the login and a dummy claim with the appropriate criterion is is used on page load. I would like to accomplish this without re-writing the existing sts service. Does anyone know if it is possible to create a dummy claim and when the main site is call inject this into document. I feel comfortable with working around the authentication (isAuthenticated) but I'm not sure about the claim for authorization. I'd appreciate any suggestions or hints on where to look/read up on creating a development/stub claim.

thanks in advance,

不确定代码中最好的注入位置是什么,但是您始终可以使用所需的任何声明自己创建ClaimsIdentity / ClaimsPrincipal。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM