This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from mkurz/AuthenticateDIFix
Added injected Authenticate controller
- Loading branch information
Showing
3 changed files
with
39 additions
and
12 deletions.
There are no files selected for viewing
13 changes: 1 addition & 12 deletions
13
code/app/com/feth/play/module/pa/controllers/Authenticate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
code/app/com/feth/play/module/pa/controllers/AuthenticateBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.feth.play.module.pa.controllers; | ||
|
||
import play.mvc.Controller; | ||
import play.mvc.Http.Response; | ||
|
||
import com.feth.play.module.pa.PlayAuthenticate; | ||
|
||
public class AuthenticateBase extends Controller { | ||
|
||
protected static final String PAYLOAD_KEY = "p"; | ||
|
||
public static void noCache(final Response response) { | ||
// http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers | ||
response.setHeader(Response.CACHE_CONTROL, "no-cache, no-store, must-revalidate"); // HTTP 1.1 | ||
response.setHeader(Response.PRAGMA, "no-cache"); // HTTP 1.0. | ||
response.setHeader(Response.EXPIRES, "0"); // Proxies. | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
code/app/com/feth/play/module/pa/controllers/AuthenticateDI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.feth.play.module.pa.controllers; | ||
|
||
import play.mvc.Controller; | ||
import play.mvc.Result; | ||
|
||
import com.feth.play.module.pa.PlayAuthenticate; | ||
|
||
public class AuthenticateDI extends AuthenticateBase { | ||
|
||
public Result authenticate(final String provider) { | ||
noCache(response()); | ||
final String payload = request().getQueryString(PAYLOAD_KEY); | ||
return PlayAuthenticate.handleAuthentication(provider, ctx(), payload); | ||
} | ||
|
||
public Result logout() { | ||
noCache(response()); | ||
return PlayAuthenticate.logout(session()); | ||
} | ||
} |