Я сделал STS, переопределив SecurityTokenService и разместив его с помощью WCF. Также я создал доверяющую сторону и тестовый клиент. Клиент успешно перенаправляется на STS (программа останавливается, если поставить точку останова в методе GetOutputIdentity). Теперь мне нужно отклонить acces в моем RP для всех пользователей, кроме одной роли. Как мне это сделать? Ее моя настройка программы:WCF отказывает кому-либо без конкретной роли с помощью пользовательских STS
protected override ClaimsIdentity GetOutputClaimsIdentity(ClaimsPrincipal principal,
RequestSecurityToken request,
Scope scope)
{
string authenticationType = principal.Identity.AuthenticationType;
var outputIdentity = new ClaimsIdentity(authenticationType);
outputIdentity.AddClaim(new Claim(ClaimTypes.Role, role));
outputIdentity.AddClaim(new Claim(ClaimTypes.Name, userName));
return outputIdentity;
}
Полагаясь конфигурация партии:
<customBinding>
<binding name="secureBinding">
<security authenticationMode="IssuedToken" requireDerivedKeys="false" >
<issuedTokenParameters>
<issuer address="http://localhost:1318/Services/SecurityTokenService.svc">
</issuer>
<issuerMetadata address="http://localhost:1318/Services/SecurityTokenService.svc/mex"></issuerMetadata>
</issuedTokenParameters>
</security>
<httpTransport></httpTransport>
</binding>
</customBinding>