Is there any OAuth2 provider available for Scala that I can use with Scalatra or Play2 web framework?
I have already seen this answer: OAuth 2.0 provider implementation for Scala/Lift
I am looking for a provider library and not an OAuth2.0 client library.
Scala OAuth2.0 Provider was what I was looking for: http://tuxdna.in/blog/2014/07/09/oauth2-dot-0-server-using-play-2-dot-0-framework-in-scala/
You should take a look to this:
If the purpose of the OAuth2 provider is to authenticate people, you should be looking for an OpenID Connect Provider. Of course you could invent your own authentication protocol... but you'd probably do so both insecurely, and incompletely. And you'd just be adding to the long list of proprietary OAuth2 protocols here http://www.gluu.co/oauth-pocket-reference (if your website is popular enough).
OpenID Connect is a profile of OAuth2 that is used by Google, and is projected by industry experts (from Gartner to Forrester and beyond...) to become a standard as ubiquitous as LDAP and Kerberos (in fact, due to support for native AND web authentication, it can integrate all those apps that SAML missed, like server login. For example, see PAM OpenID Connect: http://www.gluu.co/pamoidc
There are several good open source OpenID Connect OPs out there. NTT is rumored to have a Scala OpenID Connect OP, but it hasn't been published before.
Your scala app should probably be an OpenID Connect RP--not an OP. If you want to deploy a production ready, scalable OpenID Connect OP, you should consider OX: http://ox.gluu.org