Mrjndong / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

Can never set AUTHENTICATE_ONLY to authenticationStrategy. #180

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. To reproduce use version 2.2 or the latest trunk
2. use google as your provider
3. Following the examples do :

SocialAuthConfig config = SocialAuthConfig.getDefault();
config.load();

SocialAuthManager manager = new SocialAuthManager();
manager.setSocialAuthConfig(config);

String url = manager.getAuthenticationUrl("google", successUrl, 
Permission.AUTHENTICATE_ONLY);

4. Now to make sure that you use authenticate only you can also set it to the 
manager, like so (of course before creathing the URL) :

manager.setPermission(provider, Permission.AUTHENTICATE_ONLY);

What is the expected output? What do you see instead?

Expected:
The Permission.AUTHENTICATE_ONLY gets trickled down to the 
authenticationStrategy that is set in the AuthProvider (in this case the class 
GoogleImpl).

What version of the product are you using? On what operating system?
Version 2.2 and trunk Mac OS X

Please provide any additional information below.

The cause is the following in trunk and version 2.2 :

In the GoogleImpl class the constructor sets the scope for the 
authenticationStrategy like so :
authenticationStrategy.setPermission(scope);

Now if after creation of the manager you sets another permission through :
manager.setPermission(provider, Permission.AUTHENTICATE_ONLY);

The GoogleImpl class will set its own variable scope like so:
public void setPermission(final Permission p) {
    LOG.debug("Permission requested : " + p.toString());
    this.scope = p;
}

but it does not update the authenticationStrategy. Thus the 
authenticationStrategy persmission is always null.

Original issue reported on code.google.com by administ...@imaginateit.com on 17 May 2012 at 3:01

GoogleCodeExporter commented 8 years ago

Original comment by tar...@brickred.com on 23 May 2012 at 10:14

GoogleCodeExporter commented 8 years ago

Original comment by tar...@brickred.com on 23 May 2012 at 10:14

GoogleCodeExporter commented 8 years ago
Code checked-in in SVN. It will be available in upcoming release.

Regards
Tarun

Original comment by tar...@brickred.com on 7 Jun 2012 at 3:59