Authentication via WebService by default MembershipProvider

What is the best practice when you need to authenticate a specific OperationContractsone using default MembershipProvidersecurity ( FormsAuthentication).

I assume that the execution Membership.ValidateUserand Membership.GetUsersimply will not cut it when using WebServices, right?

In other words: How can I check if a user is allowed to use certain methods in a web service (that the user is authenticated / "logged in")?

+3
source share
2 answers
+3

, , , , WCF -, -. , - .

, , (CAS) .

( )

internal class ServiceWrapper
{
    Service Svc;
    public ServiceWrapper()
    {
        Svc = ServiceClient();
    }

    [System.Security.Permissions.PrincipalPermission(System.Security.Permissions.SecurityAction.Demand, Role = "HelloWorld")]
    public string HelloWorld()
    {
        return Svc.HelloWorld();
    }
}

, CAS ( ), WCF, . , , WCF , : -)

...

!

+1

Source: https://habr.com/ru/post/1739598/


All Articles