I am developing a WCF service with some kind of authentication.
All users will be equal, so I am planning to require sessions and have only a method that initiates a session and doesn't terminates it. Simplifying:
[OperationContract(IsInitiating = true, IsTerminating = false)]
void Open(String user, String password);
So, if the password is wrong (again, this is a simplification) I would raise an exception so the session would end. This way, I don't need to check credentials in every method call.
Is this a good approach? If not, why?
Update: I had to write this on a hurry so I'll try to elaborate a bit and make my question clearer.
The authentication method is a requirement, and I'm not asking about it. I want to know about session managing.
When I use the [OperationContract(IsInitiating=true, IsTerminating=false)] a session is started. I don't need to store an ID or anything; WCF manages everything. When an exception is raised or a method with IsTerminating=true is called, the session ends, and subsequent calls to the service methods fail, until a new session is initiated.
What I want to know is if it's reasonably easy for an attacker to bypass the WCF session management stuff, creating one on its own without calling Open, the only method of my service with IsInitiating=true and IsTerminating=false, so, the only way to lawfully start a session.