Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98c277b

Browse files
committed
General cleanup
1 parent 6d04069 commit 98c277b

File tree

5 files changed

+24
-28
lines changed

5 files changed

+24
-28
lines changed

code/app/com/feth/play/module/pa/PlayAuthenticate.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract static class Resolver {
3131

3232
/**
3333
* This is the route to your login page
34-
*
34+
*
3535
* @return
3636
*/
3737
public abstract Call login();
@@ -43,7 +43,7 @@ public abstract static class Resolver {
4343
* the setting
4444
* afterAuthFallback
4545
* You can use this to redirect to an external URL for example.
46-
*
46+
*
4747
* @return
4848
*/
4949
public abstract Call afterAuth();
@@ -55,27 +55,27 @@ public abstract static class Resolver {
5555
* however you might provide your own authentication implementation if
5656
* you want to
5757
* and point it there
58-
*
58+
*
5959
* @param provider
6060
* The provider ID matching one of your registered providers
6161
* in play.plugins
62-
*
62+
*
6363
* @return a Call to follow
6464
*/
6565
public abstract Call auth(final String provider);
6666

6767
/**
6868
* If you set the accountAutoMerge setting to true, you might return
6969
* null for this.
70-
*
70+
*
7171
* @return
7272
*/
7373
public abstract Call askMerge();
7474

7575
/**
7676
* If you set the accountAutoLink setting to true, you might return null
7777
* for this
78-
*
78+
*
7979
* @return
8080
*/
8181
public abstract Call askLink();
@@ -86,7 +86,7 @@ public abstract static class Resolver {
8686
* the setting
8787
* afterLogoutFallback
8888
* You can use this to redirect to an external URL for example.
89-
*
89+
*
9090
* @return
9191
*/
9292
public abstract Call afterLogout();
@@ -471,7 +471,7 @@ public static Result handleAuthentication(final String provider,
471471
// so this is a signup, not a link
472472
if (isLoggedIn) {
473473
oldIdentity = getUserService().getLocalIdentity(oldUser);
474-
isLoggedIn &= oldIdentity != null;
474+
isLoggedIn = oldIdentity != null;
475475
if (!isLoggedIn) {
476476
// if isLoggedIn is false here, then the local user has
477477
// been deleted/deactivated
@@ -490,7 +490,7 @@ public static Result handleAuthentication(final String provider,
490490
// 1. -> Login
491491
loginUser = newUser;
492492

493-
} else if (isLinked && isLoggedIn) {
493+
} else if (isLinked) {
494494
// 2. -> Merge
495495

496496
// merge the two identities and return the AuthUser we want
@@ -527,7 +527,7 @@ public static Result handleAuthentication(final String provider,
527527
loginUser = newUser;
528528
}
529529

530-
} else if (!isLinked && !isLoggedIn) {
530+
} else if (!isLoggedIn) {
531531
// 3. -> Signup
532532
loginUser = signupUser(newUser);
533533
} else {

code/app/com/feth/play/module/pa/controllers/Authenticate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
public class Authenticate extends Controller {
1111

12-
12+
1313
private static final String PAYLOAD_KEY = "p";
14-
14+
1515
public static void noCache(final Response response) {
1616
// http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers
1717
response.setHeader(Response.CACHE_CONTROL, "no-cache, no-store, must-revalidate"); // HTTP 1.1

code/app/com/feth/play/module/pa/providers/oauth1/OAuth1AuthProvider.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,16 @@ public Object authenticate(final Context context, final Object payload)
131131

132132
final String callbackURL = getRedirectUrl(request);
133133

134-
final Either<OAuthException, RequestToken> reponse = service
134+
final Either<OAuthException, RequestToken> response = service
135135
.retrieveRequestToken(callbackURL);
136136

137-
if (reponse.isLeft()) {
137+
if (response.isLeft()) {
138138
// Exception happened
139-
throw new AuthException(reponse.left().get()
139+
throw new AuthException(response.left().get()
140140
.getLocalizedMessage());
141141
} else {
142142
// All good, we have the request token
143-
final RequestToken rtoken = reponse.right().get();
143+
final RequestToken rtoken = response.right().get();
144144

145145
final String token = rtoken.token();
146146
final String redirectUrl = service.redirectUrl(token);
@@ -152,7 +152,7 @@ public Object authenticate(final Context context, final Object payload)
152152
}
153153

154154
}
155-
155+
156156
protected JsonNode signedOauthGet(final String url,
157157
final OAuthCalculator calculator) {
158158
final Future<Response> future = WS.url(url).sign(calculator).get();
@@ -169,16 +169,13 @@ protected OAuthCalculator getOAuthCalculator(final OAuth1AuthInfo info) {
169169
c.getString(SettingKeys.CONSUMER_KEY),
170170
c.getString(SettingKeys.CONSUMER_SECRET));
171171

172-
final OAuthCalculator op = new OAuthCalculator(cK, token);
173-
return op;
172+
return new OAuthCalculator(cK, token);
174173
}
175174

176175
/**
177176
* This allows custom implementations to enrich an AuthUser object or
178177
* provide their own implementation
179-
*
180-
* @param i
181-
* @param state
178+
*
182179
* @return
183180
* @throws AuthException
184181
*/

code/app/com/feth/play/module/pa/providers/oauth2/OAuth2AuthProvider.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected String getAuthUrl(final Request request, final String state)
106106
final List<NameValuePair> params = getAuthParams(c, request, state);
107107
return generateURI(c.getString(SettingKeys.AUTHORIZATION_URL), params);
108108
}
109-
109+
110110
protected List<NameValuePair> getAuthParams(final Configuration c,
111111
final Request request, final String state) throws AuthException {
112112
final List<NameValuePair> params = getParams(request, c);
@@ -183,8 +183,7 @@ public Object authenticate(final Context context, final Object payload)
183183
.getQueryString(request, Constants.CODE);
184184

185185
final I info = getAccessToken(code, request);
186-
final AuthUserIdentity u = transform(info, state);
187-
return u;
186+
return transform(info, state);
188187
// System.out.println(accessToken.getAccessToken());
189188
} else {
190189
// no auth, yet
@@ -193,7 +192,7 @@ public Object authenticate(final Context context, final Object payload)
193192
return url;
194193
}
195194
}
196-
195+
197196
protected boolean isCallbackRequest(final Context context) {
198197
return context.request().queryString().containsKey(Constants.CODE);
199198
}
@@ -205,7 +204,7 @@ protected String getErrorParameterKey() {
205204
/**
206205
* This allows custom implementations to enrich an AuthUser object or
207206
* provide their own implementaion
208-
*
207+
*
209208
* @param info
210209
* @param state
211210
* @return

code/app/com/feth/play/module/pa/providers/openid/OpenIdAuthUser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public class OpenIdAuthUser extends AuthUser {
1111

1212
/**
13-
*
13+
*
1414
*/
1515
private static final long serialVersionUID = 1L;
1616

0 commit comments

Comments
 (0)