OpenID based providers

To configure OpenID based providers you must use the OpenIDSettings class. This class has the following form:

case class OpenIDSettings(
  providerURL: String,
  callbackURL: String,
  axRequired: Map[String, String] = Map.empty,
  axOptional: Map[String, String] = Map.empty,
  realm: Option[String] = None)
PropertyDescription
providerURLThe OpenID provider URL used if no openID was given
callbackURLThe callback URL to the application after a successful authentication on the OpenID provider. The URL can be a relative path which will be resolved against the current request's host
axRequiredRequired attributes to return from the provider after a successful authentication
axOptionalOptional attributes to return from the provider after a successful authentication
realmOpenID Authentication request is valid

Callback URL

The callbackURL must point to your action which is responsible for the authentication over your defined providers. So if you define the following route as example:

GET  /authenticate/:provider  @controllers.SocialAuthController.authenticate(provider)

Then your callbackURL must have the following format:

callbackURL="https://your.domain.tld/authenticate/yahoo"

Example

steam {
  providerURL="https://steamcommunity.com/openid/"
  callbackURL="https://your.domain.tld/authenticate/steam"
  realm="https://your.domain.tld"
}

yahoo {
  providerURL="https://me.yahoo.com/"
  callbackURL="https://your.domain.tld/authenticate/yahoo"
  axRequired={
    "fullname": "http://axschema.org/namePerson",
    "email": "http://axschema.org/contact/email",
    "image": "http://axschema.org/media/image/default"
  }
  realm="https://your.domain.tld"
}

Override the configuration locally

Basically the configuration of the providers will be done globally on provider instantiation. But in some circumstances it is necessary to override this globally configuration with other values. This can be done with the withSettings method that every SocialProvider has implemented. The withSettings methods accepts a function which gets the current configuration as parameter and which must return a new configuration.

provider.withSettings { config =>
  config.copy("new-value")
}.authenticate()

What’s Next