I have a few questions in relation to how to do authentication/authorization with MVC asp.net.
I have a bunch of WCF services that authenticate/authorise the user by passing the username and password on each request ( i validate using a HttpModule, and catching the Authenticating event in WCF). It uses aspnet membership within that HttpModule to validate the user and also sets the Principal so I can have roles on my services (these services are shared to various clients of ours so I need to keep how this works).
Now i want to create a MVC project which will be able to call these services, but I dont want to save the username and password in the session and pass it to each request.
I have a scenario with a few gaps in it if anyone can please help me!
I turn on the AuthenticationService that WCF offers on the WCF service Layer.
In my MVC project, I add forms authentication, and decorate my methods with the authorize attribute, which will redirect me to the log in page if i am not authorized.
In the login page, when a user gives his/her username and pwd, I call the WCF AuthenticationService to login my user. Then I retrieve the Authentication token from this and store it in my session.
The next time i want to call a WCF service on my service layer, I retrieve this token and add it to the header of my request.
On the HttpModule that validates my user on the Service Side, I check if its a valid token OR if its a valid username or password (to facilitate other people calling these web services).
If it is, it accepts the request and returns the correct data..
Does this seem like the correct way to approach this??
Any help is greatly appreciated.. :/ Thanks in advance! Neil