Пример #1
0
 /**
  * Check the identity of the user from the current request, that should be the callback from the
  * OpenID server
  */
 public static F.Promise<UserInfo> verifiedId() {
   Request request = Http.Context.current().request();
   scala.concurrent.Future<UserInfo> scalaPromise =
       play.api.libs.openid.OpenID.verifiedId(request.queryString())
           .map(
               new AbstractFunction1<play.api.libs.openid.UserInfo, UserInfo>() {
                 @Override
                 public UserInfo apply(play.api.libs.openid.UserInfo scalaUserInfo) {
                   return new UserInfo(
                       scalaUserInfo.id(),
                       JavaConversions.mapAsJavaMap(scalaUserInfo.attributes()));
                 }
               },
               Invoker.executionContext());
   return F.Promise.wrap(scalaPromise);
 }
Пример #2
0
 /**
  * Retrieve the URL where the user should be redirected to start the OpenID authentication process
  */
 public static F.Promise<String> redirectURL(
     String openID,
     String callbackURL,
     Map<String, String> axRequired,
     Map<String, String> axOptional,
     String realm) {
   if (axRequired == null) axRequired = new HashMap<String, String>();
   if (axOptional == null) axOptional = new HashMap<String, String>();
   return F.Promise.wrap(
       play.api.libs.openid.OpenID.redirectURL(
           openID,
           callbackURL,
           JavaConversions.mapAsScalaMap(axRequired).toSeq(),
           JavaConversions.mapAsScalaMap(axOptional).toSeq(),
           Scala.Option(realm)));
 }