I have a Web API Web service which is used by a number of client applications with different technologies like Java, .NET, etc. Therefore, my user credentials are stored in a separate database.
My Web Service is hosted within IIS and I have configured and enabled SSL on the server side which makes sure that the Request/Response Messages are encrypted and signed.
I've also configured IP Address Restriction feature of IIS to allow the requests from a handful of known IP Addresses.
I don't like to use Basic Authentication since it sends the credentials in plain text with every single message although the message is encrypted using SSL.
I can't use Integrated Windows Authentication obviously because my users are not on the same domain as my server.
I can't use Forms authentication since my clients are not browser-based.
So what's the best way to implement Authentication and Authorization for my web service?
I was thinking one approach would be to provide an Authenticate(username, password) web method which behaves like an Identity Provider/Security-token-service and generates a token specific to that user which expire after certain time. Then the client must be sending the authentication token with each web method request and I make sure of it by creating a Custom Authorization Filter for my controller.
The advantage of this approach is that the user doesn't have to send username/password with each request but just a temporary token. The disadvantage is obviously managing the token life; when should it expire? e.g. if no request was made within an hour.
What's the best way to implement Authentication and Authorization for my web service?