Code Monkey home page Code Monkey logo

play-authenticate's People

Contributors

akitaylor avatar alph486 avatar antonsarov avatar bencarlson avatar bravegag avatar brecht-d-m avatar canoztokmak avatar dborisenko avatar dribba avatar enalmada avatar fhars avatar frederick036 avatar gkovbasenko avatar joscha avatar joslash avatar jtammen avatar kadekm avatar lafayette avatar mkurz avatar mortimerp9 avatar oexza avatar petru-ghita avatar promansew avatar rui-ferreira avatar sealskej avatar slimandslam avatar smola avatar sweigardc avatar thandaanda avatar tjdett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-authenticate's Issues

Customize where users are redirected to with each provider

In my Play! Authenticate, I need to redirect users who login with Facebook (or other social network) for the first time to be redirected to a custom URL. That way, I can get users to import their friends on their first Facebook login (i.e. account creation).

Is that possible currently? Maybe it would have to be a new setting or group of settings for each provider?

Automatically linking accounts if same email is used

I'm not sure if this is a feature request or a support question:

Is it currently possible to link (instead of sign up) a Facebook account to a UsernamePassword account when they have the same email? My exact use case:

  1. I do not want different registered users with the same email.
  2. If a Facebook account is signed up and it matches the email of a user with a UsernamePassword account, I want the ask_link prompt used. If accepted, accounts are linked. If rejected, signup won't happen (an error will be issued).
  3. If a UsernamePassword account is signed up and it matches the email of a user with a FacebookAccount, it should issue an error (it could make sense to offer a link of the new UsernamePassword account to the existing Facebok account, but at the moment, refusing the sign up would be enough for me).

Step 1 and 3 already work like this for my UsernamePassword accounts, but not for Facebook accounts.

I did implement this mechanism myself in my play-authenticate fork, but it's getting really convoluted and mesy. What would be the correct approach to this?

play-authenticate-usage sample app: Provider 'google' missing needed setting 'clientId'

When I run the sample play-authenticate-usage sample application I get a provider error with the following stack trace:

! @6c4e730hl - Internal server error, for request [GET /] ->

play.api.UnexpectedException: Unexpected exception [RuntimeException: Provider 'google' missing needed setting 'clientId']
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:134) ~[play_2.9.1.jar:2.0.4]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0.4]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0.4]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:110) ~[play_2.9.1.jar:2.0.4]
at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-library.jar:0.11.3]
Caused by: java.lang.RuntimeException: Provider 'google' missing needed setting 'clientId'
at com.feth.play.module.pa.providers.AuthProvider.onStart(AuthProvider.java:73) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.4]
at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.4]
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.3]
at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.3]
at play.api.Play$.start(Play.scala:60) ~[play_2.9.1.jar:2.0.4]

Any idea what the issue is here?

no HTTP context

I am using Play 2.1 and your latest stable...

I have a piece of code from your sample:

@forProviders() { p =>
    <a href="@p.getUrl()">@p.getKey()</a>   <br/>

}

The @forProvers line blows up with

[RuntimeException: There is no HTTP Context available from here.]

Any lead on what it could be?

Handle Result return value from AuthProvider.authenticate method

Currently it's only possible to return a String with the url to redirect to or to return the authenticated user object.

It would be nice to have the possibility to return a Result object with the contents to show instead of having to redirect the user before showing him a error message.

Or was there any reason not to implement this?

[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-mailer_2.10;2.0.4: not found

Hi all,

I download code and decompression. when i run 'play eclipse', serveral errors happen.
eg.: at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structu
re.scala:311)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structu
re.scala:311)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
at sbt.std.Transform$$anon$5.work(System.scala:71)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:23
2)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:23
2)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:238)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestric
tions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
at java.lang.Thread.run(Thread.java:722)
error sbt.ResolveException: unresolved dependency: com.typesafe#pla
y-plugins-mailer_2.10;2.0.4: not found
[error] Could not create Eclipse project files:
[error] Error evaluating task 'dependency-classpath': error
[error] Error evaluating task 'external-dependency-classpath': error
[error] Error evaluating task 'update': error
[error] Error evaluating task 'external-dependency-classpath': error
[error] Error evaluating task 'update': error

My build.scala:
val appName = "play-authenticate-usage"
val appVersion = "1.0-SNAPSHOT"

val appDependencies = Seq(
  "be.objectify" %% "deadbolt-java" % "2.1-SNAPSHOT",
  "com.feth"      %%  "play-authenticate" % "0.2.3-SNAPSHOT",
  "postgresql"    %   "postgresql"        % "9.1-901.jdbc4"
)

// Uncomment this for local development of the Play Authenticate core:
/*
val playAuthenticate = PlayProject(
"play-authenticate", "1.0-SNAPSHOT", mainLang = JAVA, path = file("modules/play-authenticate")
).settings(
libraryDependencies += "org.apache.httpcomponents" % "httpclient" % "4.2",
libraryDependencies += "com.feth" %% "play-easymail" % "0.1-SNAPSHOT",
libraryDependencies += "org.mindrot" % "jbcrypt" % "0.3m",
libraryDependencies += "commons-lang" % "commons-lang" % "2.6",

  resolvers += Resolver.url("play-easymail (release)", url("http://joscha.github.com/play-easymail/repo/releases/"))(Resolver.ivyStylePatterns),
  resolvers += Resolver.url("play-easymail (snapshot)", url("http://joscha.github.com/play-easymail/repo/snapshots/"))(Resolver.ivyStylePatterns)
)

*/

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
  resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns),
  resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns),

  resolvers += Resolver.url("play-easymail (release)", url("http://joscha.github.com/play-easymail/repo/releases/"))(Resolver.ivyStylePatterns),

resolvers += Resolver.url("play-easymail (snapshot)", url("http://joscha.github.com/play-easymail/repo/snapshots/"))(Resolver.ivyStylePatterns),

resolvers += Resolver.url("play-authenticate (release)", url("http://joscha.github.com/play-authenticate/repo/releases/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("play-authenticate (snapshot)", url("http://joscha.github.com/play-authenticate/repo/snapshots/"))(Resolver.ivyStylePatterns)
)

I use play-2.1-RC2

Google provider expires in 1 hour, does not refresh

I have realized that the google provider when it receives the access token, sets the expires_in property to 3560 (about 1 hour). This is contradictory to the behavior of the profile page when it tells me that the authentication expires "Never". After authenticating with google and waiting 1 hour, when I try to use restricted content on my page, it forwards me to the login screen (even though the subject is present via the deadbolt command @subjectPresentOr [true])

I looked into this a bit and found that google authentication tokens can be refreshed using refresh tokens: https://developers.google.com/accounts/docs/OAuth2

has thought been put into implementing this functionality to refresh the OAuth tokens?

NullPointerException on Facebook auth error?

If you go to /authenticate/facebook?code=<CODE> twice (using the same code, of course this shouldn't happen), you get a NullPointerException:

play.api.Application$$anon$1: Execution exception[[NullPointerException: null]]
        at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10-2.1.0.jar:2.1.0]
        at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10-2.1.0.jar:2.1.0]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:132) [play_2.10-2.1.0.jar:2.1.0]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:128) [play_2.10-2.1.0.jar:2.1.0]
        at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10-2.1.0.jar:2.1.0]
        at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10-2.1.0.jar:2.1.0]
java.lang.NullPointerException: null
        at com.feth.play.module.pa.providers.oauth2.facebook.FacebookAuthProvider.buildInfo(FacebookAuthProvider.java:65) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]
        at com.feth.play.module.pa.providers.oauth2.facebook.FacebookAuthProvider.buildInfo(FacebookAuthProvider.java:22) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]
        at com.feth.play.module.pa.providers.oauth2.OAuth2AuthProvider.getAccessToken(OAuth2AuthProvider.java:94) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]
        at com.feth.play.module.pa.providers.oauth2.OAuth2AuthProvider.authenticate(OAuth2AuthProvider.java:162) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]
        at com.feth.play.module.pa.PlayAuthenticate.handleAuthentication(PlayAuthenticate.java:456) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]
        at com.feth.play.module.pa.controllers.Authenticate.authenticate(Authenticate.java:26) ~[play-authenticate_2.10.jar:0.2.5-SNAPSHOT]

Headers of Facebook response:

Response DefaultHttpResponse(chunked: false)
HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
WWW-Authenticate: OAuth "Facebook Platform" "invalid_code" "This authorization code has been used."
X-FB-Rev: 748457
X-FB-Debug: Tz4gbf3Yx6/dSFbxkjgbJrOmnmNjVK3V4ii9MzjpjfE=
Date: Tue, 05 Mar 2013 08:59:07 GMT
Connection: keep-alive
Content-Length: 97

And relevant lines line FacebookAuthProvider.java:

protected FacebookAuthInfo buildInfo(final Response r)
    throws AccessTokenException {
        if (r.getStatus() >= 400) {
            throw new AccessTokenException(r.asJson().get(MESSAGE).asText());

So it produces NullPointerException instead of AccessTokenException.

NTLM support

In most Enterprise configurations, there is a need for Windows-based SSO. NTLM v2 support would enable Play! In the Enterprise.

Module prevents standalone/junit execution

This seems related to what is being described a little way down in #20 Each time you try to run Play from within a self contained Application, like so:

public class QueueWorker {
    public static void main(String[] args) {
        Application application = new Application(new File(args[0]), QueueWorker.class.getClassLoader(), null, Mode.Dev());
        Play.start(application);
    }
}

(a standalone job or a JUnit test class) you get an Exception coming from the EhCache provider:

--> [�[37minfo�[0m] play - database [default] connected at jdbc:h2:mem:play
[�[37minfo�[0m] play - database [default] connected at jdbc:h2:mem:play
Exception in thread "main" net.sf.ehcache.ObjectExistsException: Cache play already exists
    at net.sf.ehcache.CacheManager.addCache(CacheManager.java:990)
    at play.api.cache.EhCachePlugin.x$3(Cache.scala:111)
    at play.api.cache.EhCachePlugin.cache(Cache.scala:109)
    at play.api.cache.EhCachePlugin.onStart(Cache.scala:127)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at play.api.Play$$anonfun$start$1.apply(Play.scala:60)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at play.api.Play$.start(Play.scala:60)
    at play.api.Play.start(Play.scala)
    at jobs.QueueWorker.main(QueueWorker.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

I can reproduce this behavior on play 2.0.3 and play 2.0.4 on two different development machines. To reproduce, do the following steps:

  1. git clone https://github.com/joscha/play-authenticate.git
  2. Copy the QueueWorker class from above to play-authenticate/samples/java/play-authenticate-usage/app/jobs
  3. Launch QueueWorker with "." as a parameter from command line or Ide (or Procfile on Heroku)

Unfortunately this even happens, when you add the play-authenticate dependency 0.2.0-SNAPSHOT to Build.scala and configure nothing else.

Cannot get past "Verify Email" state when signing up users

I want to make it so when a non-signup user clicks a certain restricted link, it will redirect them to the "signup" screen (not 'Login' screen which usually happens on restricted). After clicking signup, the user is redirected back to the original restricted link url...but its not working this way.

To do this, I have my action check if there is a current user signed in, if not, it redirects to the signup page and stores the:

        // The restrictred URL
    public static Result start() {
        User user = Application.getLocalUser(session());

        if (user == null) {
            PlayAuthenticate.storeOriginalUrl(ctx());
            return redirect(routes.Application.signup());
        } else {
            return ok(learn.render());
        }
    }

Then my MyUsernamePasswordAuthProvider returns SignupResult.USER_CREATED:

    @Override
    protected SignupResult signupUser(final MyUsernamePasswordAuthUser user) {
        final User u = User.findByUsernamePasswordIdentity(user);
        if (u != null) {
            if (u.emailValidated) {
                // This user exists, has its email validated and is active
                return SignupResult.USER_EXISTS;
            } else {
                // this user exists, is active but has not yet validated its
                // email
                return SignupResult.USER_EXISTS_UNVERIFIED;
            }
        }
        // The user either does not exist or is inactive - create a new one
        @SuppressWarnings("unused")
        final User newUser = User.create(user);
        // Usually the email should be verified before allowing login, however
        // if you return
        return SignupResult.USER_CREATED;
        // then the user gets logged in directly
          //  return SignupResult.USER_CREATED_UNVERIFIED;
    }

You would think that after the user clicks the signup button, it will redirect back to the "start" url which is the restricted action, however what happens is it forwards to the "home" page, the user is NOT logged in, and there is an debug statement in the logs:
[debug] application - Path where we are coming from (/start?title=asdfdsadsf) is different than the login URL (/login)

What is going on here? I cant seem to figure out what is causing this behavior...it seems to be a bug since returning SignupResult.USER_CREATED should log the user in directly

Support for Play 2.0.2?

Hi,

Just wondering if there is an ETA for support of the latest version?

If my choice is to run off a snapshot it's maybe a sign Play 2 is not mature enough (yet) and I might need to resort to using 1.2.4, which is not my preference.

Cheers.

returning SignupResult.USER_CREATED doesnt send verification email

When a user is signed up using UsernamePasswordAuthenticator, and we want to sign in the user without verifying their email first, then you return SignupResult.USER_CREATED instead of USER_CREATED_UNVERIFIED like so:

    protected com.feth.play.module.pa.providers.password.UsernamePasswordAuthProvider.SignupResult signupUser(final MyUsernamePasswordAuthUser user) {
        final User u = User.findByUsernamePasswordIdentity(user);
        if (u != null) {
            if (u.emailValidated) {
                // This user exists, has its email validated and is active
                return SignupResult.USER_EXISTS;
            } else {
                // this user exists, is active but has not yet validated its
                // email
                return SignupResult.USER_EXISTS_UNVERIFIED;
            }
        }
        // The user either does not exist or is inactive - create a new one
        @SuppressWarnings("unused")
        final User newUser = User.create(user);
        // Usually the email should be verified before allowing login, however
        // if you return
        return SignupResult.USER_CREATED;
        // then the user gets logged in directly
        //return SignupResult.USER_CREATED_UNVERIFIED;
    }

The problem is that the super method does not send the verification email when USER_CREATED is returned and since we dont have access to the context from here, we cant send it ourselves.

I suggest either sending the verification email when both USER_CREATED && USER_CREATED_UNVERIFIED is returned, OR pass the context down to this method so we can handle it ourselves if we want to.

I prefer passing down the context. It would also be useful if the method: sendVerifyEmailMailing(final Context ctx, final US user) be made protected as well so we can call it from our subclass.

form post lost when submitting while not logged in

When doing a form POST without being logged in, the POST data is lost after the flow is complete. In the logs I see "The path we are coming from is the Login URL - delete jumpback". I looked in the code and it seems that only GET requests work through the login flow.

It would be ideal to have the form page open to not logged in users so they feel invested in continuing through the login process after they have filled out the form. And sometimes a user can be timed out without knowing it. In both those cases it is frustrating to lose the post data.

Can the playauthenticate code be enhanced to allow post form data to be persisted through the login flow?

Is redirect after 'user exists' necessary in UsernamePasswordAuthProvider?

Do I understand it correctly that method UsernamePasswordAuthProvider.userExists() implies that when SignupResult is USER_EXISTS a redirect should always happen?

Basically it means that there's no way to stay on the same page when the specified use already exists. How can I implement such behavior? I guess in such case preliminary validation should happen first, even before the 'signup authenticator' is called? Or is there another way?

SignupResult not found when trying to run dist

I found the following error while trying to run dist in play-authenticate-usage sample:

[play-authenticate-usage] $ dist
[info] Wrote play-authenticate-usage/target/scala-2.10/play-authenticate-usage_2.10-1.0-SNAPSHOT.pom
[info] Generating Scala API documentation for main sources to play-authenticate-usage/target/scala-2.10/api...
[error] play-authenticate-usage/app/providers/MyUsernamePasswordAuthProvider.java:126: not found: type SignupResult
[error]     protected SignupResult signupUser(final MyUsernamePasswordAuthUser user) {
[error]               ^
[error] play-authenticate-usage/app/providers/MyUsernamePasswordAuthProvider.java:149: not found: type LoginResult
[error]     protected LoginResult loginUser(
[error]               ^
model contains 98 documentable templates
[error] two errors found
[error] (compile:doc) Scaladoc generation failed
[error] Total time: 15 s, completed Feb 11, 2013 12:55:47 PM 

null pointer error

Hi I am using the 0.20 SNAPSHOT. Maybe I am missing something in how I include the module. But I keep getting this error when I try any of the routes. I have the same build file, routes, models and controller methods as the simple-oauth example. The example included works. Any idea what I may be doing wrong.

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPointerException: null]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.3]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.3]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.3]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.NullPointerException: null
at com.feth.play.module.pa.providers.ext.ExternalAuthProvider.getRedirectUrl(ExternalAuthProvider.java:45) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.providers.oauth2.OAuth2AuthProvider.getParams(OAuth2AuthProvider.java:124) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.providers.oauth2.OAuth2AuthProvider.getAuthUrl(OAuth2AuthProvider.java:103) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.providers.oauth2.OAuth2AuthProvider.authenticate(OAuth2AuthProvider.java:169) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.handleAuthentication(PlayAuthenticate.java:442) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.controllers.Authenticate.authenticate(Authenticate.java:16) ~[play-authenticate_2.9.1-0.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]

loginAndRedirect optional

I'm using a ajax request to login the user and just want to return a 200 status code. Is it possible to do the redirect optional somehow?

Scala Play app example

Thanks very much for this useful module.

Just one request - It would be really handy to have an example implementation for a Scala Play app.

Add User Guide and Documentation

Hi,

Can you please add a user guide and documentation on how to integrate/ use this plugin? That will be really helpful.

Thanks & Regards,
Abhi

[2.1-java] Does not work with Play 2.1

Hello,
we are trying to get module working with Play 2.1. We changed build.properties to "sbt.version=0.12.0" and tried to run sample project, but we got this error:

[error] (*:update) sbt.ResolveException: unresolved dependency: be.objectify#deadbolt-2_2.9.2;1.1.3-SNAPSHOT: not found
[error] unresolved dependency: com.feth#play-authenticate_2.9.2;0.2.0-SNAPSHOT: not found

According README play-authenticate should work with 2.0.2 and later.

Add an event API?

While working on a remember me provider (see issue #38) I created Resolver.onAuthSuccessHook(). This looks a bit forced to me so I looked up in SecureSocial and saw its Events API. Adding such API would help remember me and it would probably make code for other use cases cleaner.

What are your thoughts on this?

Compil Bug : method prefix [play 2.0.1 and 2.0.2]

Hi

I try to run the sample but I have this message on the consol :
! Internal server error, for request [GET /] ->

sbt.PlayExceptions$CompilationException: Compilation error [object creation impossible, since:
method prefix in trait Routes of type => String is not defined
method setPrefix in trait Routes of type (prefix: String)Unit is not defined]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:224) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:221) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]

I try to find the prob but I don't really undestand where is it .

Best regards

Naiky

Memcached fails with NotSerializableException on caching GoogleAuthInfo when linking google accounts

Memcached requires objects to be serializable to store them and GoogleAuthInfo isn't.
Any reason AuthInfo.java (and anything else you put into cache) can't extend Serializable?

ERROR
Internal server error, for request [GET /authenticate/google?code=4
Execution exception [[NotSerializableException: com.feth.play.module.pa.providers.oauth2.google.GoogleAuthInfo]]
Caused by: java.io.NotSerializableException: com.feth.play.module.pa.providers.o
auth2.google.GoogleAuthInfo
at com.feth.play.module.pa.PlayAuthenticate.storeInCache(PlayAuthenticat
e.java:276) ~[com.feth.play-authenticate_2.9.1-play-authenticate_2.9.1-0.2.0-SNA
PSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.storeUserInCache(PlayAuthent
icate.java:271) ~[com.feth.play-authenticate_2.9.1-play-authenticate_2.9.1-0.2.0
-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.storeMergeUser(PlayAuthentic
ate.java:314) ~[com.feth.play-authenticate_2.9.1-play-authenticate_2.9.1-0.2.0-S
NAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.handleAuthentication(PlayAut
henticate.java:523) ~[com.feth.play-authenticate_2.9.1-play-authenticate_2.9.1-0
.2.0-SNAPSHOT.jar:0.2.0-SNAPSHOT]
at com.feth.play.module.pa.controllers.Authenticate.authenticate(Authent
icate.java:16) ~[com.feth.play-authenticate_2.9.1-play-authenticate_2.9.1-0.2.0-
SNAPSHOT.jar:0.2.0-SNAPSHOT]

Thanks for your time!

RuntimeException: Provider 'google' missing needed setting 'clientId'

Hi. We are using Play 2.0.2 on a new project, and are required to provide authentication and authorization. After looking at the plugins for Play 2.0, I decided play-authenticate would be the best choice, because it was geared towards Java, which we are using.

I cloned play-authenticate, and moved to the sample project. After getting the Database 'default' needs evolution! message, and clicking the "Apply this script now!" button, I am getting a Provider 'google' missing needed setting 'clientId' exception.

play.api.UnexpectedException: Unexpected exception [RuntimeException: Provider 'google' missing needed setting 'clientId']
        at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:134) ~[play_2.9.1.jar:2.0.2]
        at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0.2]
        at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.3]
        at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0.2]
        at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:110) ~[play_2.9.1.jar:2.0.2]
        at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-library.jar:0.11.3]
Caused by: java.lang.RuntimeException: Provider 'google' missing needed setting 'clientId'
        at com.feth.play.module.pa.providers.AuthProvider.onStart(AuthProvider.java:73) ~[play-authenticate_2.9.1-0.1.9-SNAPSHOT.jar:0.1.9-SNAPSHOT]
        at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.2]
        at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.2]
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.3]
        at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.3]
        at play.api.Play$.start(Play.scala:60) ~[play_2.9.1.jar:2.0.2]

I have tried commenting out the entire google section, and even adding a clientId in conf/play-authenticate/mine.conf, but I still get the exception.

Let me know if I can provide more information to help. I would love to look into this myself and fix it, but I'm under a pretty tight schedule.

Thank you!

How should I implement my own salt?

First of all thank you for a great project!

I'm moving my application from seam to play. The developer before me
implemented the user/password login with salt where the password is
built up like this:

salt = salt != null ? salt : randomAlphanumeric(32);
password = md5(unhashedPassword + "" + salt);

then the salt is save along with the password to the db. I guess in this case saved to LinkedAccount along with provider_user_id. I need to support this.

Im looking at your implementation in MyUsernamePasswordAuthUser and LinkedAccount
and trying to figure out where to put the logic.
I was thinking that when creating the User and calling update on LinkedAccount check for

public void update(final AuthUser authUser) {
    this.providerKey = authUser.getProvider();
    if(authUser instanceof MyUsernamePasswordAuthUser){
        this.salt = randomAlphanumeric(32);
        ((MyUsernamePasswordAuthUser) authUser).setSalt(salt);
    }
    this.providerUserId = authUser.getId();
}

the when callling getHashedPassword MyUsernamePasswordAuthUser:

public class MyUsernamePasswordAuthUser extends UsernamePasswordAuthUser
    implements NameIdentity {

private final String name;
private final transient String password;
private transient String salt;

public MyUsernamePasswordAuthUser(final MyUsernamePasswordAuthProvider.MySignup signup) {
    super(signup.password, signup.email);
    this.password = signup.password;
    this.name = signup.name;
}

@Override
public String getHashedPassword() {
    return this.createPassword(password);
}

protected String createPassword(final String clearString) {
    return HashUtils.md5(clearString + "" + salt);
}

public void setSalt(String salt) {
    this.salt = salt;
}

For login:

public class MyLoginUsernamePasswordAuthUser extends
    DefaultUsernamePasswordAuthUser {

    final static long SESSION_TIMEOUT = 24 * 14 * 3600;
    private long expiration;
    private transient String salt;

    /**
     * For logging the user in automatically
     *
     * @param email
     */
    public MyLoginUsernamePasswordAuthUser(final String email) {
        this(null, email);
    }

    public MyLoginUsernamePasswordAuthUser(final String clearPassword,
                                       final String email) {
        super(clearPassword, email);
        expiration = System.currentTimeMillis() + 1000 * SESSION_TIMEOUT;
    }

    @Override
    public boolean checkPassword(final String hashed, final String candidate) {
        if(hashed == null || candidate == null) {
            return false;
        }
        return StringUtils.equals(HashUtils.md5(candidate + "" + salt), hashed);
    }

    @Override
    public long expires() {
        return expiration;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }
}

I'm not sure what I feel about this. It feels a little bit messy. Maybe you have some better way of doing this?

Is there any plan for scala version?

Hi,

The module is great. I'm just wondering if there is any plan to make a scala version. The current secure social module is very difficult to integrate into app and do customization. The only way I can image is to modify the source code myself if I want to customize. It would be great and helpful if play-authenticate has a scala version.

Best,

Guan

MyUsernamePasswordAuthProvider.java:202: error method does not override or implement a met hod from a supertype

The method transformAuthUser doesn't need @OverRide, and that causes a compilation error so that the example fails to deploy to Heroku. I verified that when taking off @OverRide everything works. Apologies for not fixing it directly - I'm not yet familiar with the whole github process.

[error] C:\Users\clb\workspace\play-authenticate-usage\app\providers\MyUsernameP
asswordAuthProvider.java:202: error: method does not override or implement a met
hod from a supertype
[error] @OverRide

NPE when verifying user/pwd signup using unverified email from oauth

To Reproduce:
Signup using google oauth (don't verify email).
Pretend lots of time went by and you forgot you signed up with google
Signup using username/password using the email above
Click verify email and witness NPE in Signup.java verify() due to targetUser being null
final String email = ta.targetUser.email;

In the database, the arget_user_id in token_action is null
id token target_user_id type created expires
10 bbc22b64-5a1a-4510-8cf9-a589514e8d11 (null) EV 2012-10-17 15:22:57 2012-10-24 15:22:57

It seems like the reason is because the MyUsernamePasswordAuthProvider.java signupUser() returns SignupResult.USER_EXISTS_UNVERIFIED; but then verify code is only looking for emails using the same original authentication mechanism?

NullPointerException from PlayAuthenticate.link(ctx(), link);

I'm using the sample "usage" app in 2.5.0 , and when I link an existing account to an additional provider, upon returning and submitting through the confirmation page, PlayAuthenticate.link comes back with a null pointer error.

It looks like this line
https://github.com/joscha/play-authenticate/blob/master/code/app/com/feth/play/module/pa/PlayAuthenticate.java#L167
has a "u" = null.

Is this to be expected?

Full stack trace:

java.lang.NullPointerException: null
at com.feth.play.module.pa.PlayAuthenticate.storeUser(PlayAuthenticate.java:169) ~[play-authenticate_2.10-0.2.5-SNAPSHOT.jar:0.2.5-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.loginAndRedirect(PlayAuthenticate.java:396) ~[play-authenticate_2.10-0.2.5-SNAPSHOT.jar:0.2.5-SNAPSHOT]
at com.feth.play.module.pa.PlayAuthenticate.link(PlayAuthenticate.java:391) ~[play-authenticate_2.10-0.2.5-SNAPSHOT.jar:0.2.5-SNAPSHOT]
at controllers.Account.doLink(Account.java:173) ~[na:na]

Prob cannot find symbol noCache(play.mvc.Http.Response)

Hi Joscha ! Longtime ?!
I try to run the samples and I got this exception :

sbt.PlayExceptions$CompilationException: Compilation error [cannot find symbol [symbol: method noCache(play.mvc.Http.Response)] [location: class com.feth.play.module.pa.controllers.Authenticate]]

Indeed on the 0.2.1-SNAPSHOT the method com.feth.play.module.pa.controllers.Authenticate.noCache is missing

UsernamePasswordAuthUser's id shouldn't be the hashed password

First, thanks for this great framework :)

Now on to the issue.
The UsernamePasswordAuthUser's method getId() returns the hashed password. Shouldn't it return the user's email instead? The hashed password isn't unique but the email is (if all accounts with this email are merged). When would this favorable?

I will override this method to return the email instead.
Please correct me if I'm wrong :)

Thanks,
Magnus

Customize user fields to retrieve from Facebook

Facebook's Graph API allows to specify which fields to retrieve from the user.
Currently, Play! Authenticate is fetching the default ones, but it would be useful to customize this.

At the moment, I have added a setting with the list of fields that should be retrieved and added a FacebookAuthUser.getBirthday() method (which is way I needed this in the first place. You can see this here: smola@729e491

I was thinking that, maybe, it makes sense to add a method to FacebookAuthUser to retrieve the actual JSON returned by Facebook. That way, we can add any of the supported user fields to the configuration and be able to fetch it even if there is no specific method on FacebookAuthUser.

Anyway, for my specific use case, birthday is the only extra field needed.

Samples doesn´t compile in Play 2.0.4

Samples doesn´t compile in Play 2.0.4

[error] C:\workspace\play-authenticate-simple-oauth\app\controllers\Application.java:22: cannot find symbol
[error] symbol : method noCache(play.mvc.Http.Response)
[error] location: class com.feth.play.module.pa.controllers.Authenticate
[error] com.feth.play.module.pa.controllers.Authenticate.noCache(response());
[error] ^
[error] 1 error
[error] {file:/C:/workspace/play-authenticate/samples/java/play-authenticate-simple-oauth/}play-authenticate-simple-oauth/compile:compile: javac returned nonzero exit code

[error] C:\workspace\play-authenticate\samples\java\play-authenticate-usage\app\controllers\Account.java:54: cannot find symbol
[error] symbol : method noCache(play.mvc.Http.Response)
[error] location: class com.feth.play.module.pa.controllers.Authenticate
[error] com.feth.play.module.pa.controllers.Authenticate.noCache(response());
[error] ^
And in others lines and classes

Display Bug on Google Chrome

Hi,

I'm facing a display bug on the sample application.
In the full screen view of my web browser (Google Chrome), the "Log In" blue button on the right corner of the welcome page doesn't appear at all. It seems like the display of my application doesn't fit on full screen size because scroll bar appear on the right and bottom.
When i minimize the screen, it's appear suddenly !

My friend who use the same samples doesn't have this problem on Chrome...
When I'm using Internet Explorer or any browser, it's working fine.

There is some screen of my display bug :

http://www.images-host.fr/view.php?img=14080106bug-full-screen.jpg

http://www.images-host.fr/view.php?img=14080107bug-screen-minize.jpg

Thank you for your time !

Best,
Julien

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.