-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrap admin
and preview
in pan-domain-authentication
🐼
#27012
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
d2fc348
add `dev-nginx` config for `admin` and `preview` so they can be hit o…
twrichards 1850056
rename `GoogleAuthFilters` to `CommonAuthFilters` in anticipation of …
twrichards 7977086
change authentication for `preview` and `admin` to `pan-domain-authen…
twrichards File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package controllers | ||
|
||
import conf.{AllGoodCachedHealthCheck, NeverExpiresSingleHealthCheck} | ||
import play.api.libs.ws.WSClient | ||
import play.api.mvc.ControllerComponents | ||
import play.api.mvc.{Action, AnyContent, BaseController, ControllerComponents} | ||
|
||
import scala.concurrent.ExecutionContext | ||
class HealthCheck(val controllerComponents: ControllerComponents) extends BaseController { | ||
|
||
class HealthCheck(wsClient: WSClient, val controllerComponents: ControllerComponents)(implicit | ||
executionContext: ExecutionContext, | ||
) extends AllGoodCachedHealthCheck( | ||
NeverExpiresSingleHealthCheck("/login"), | ||
)(wsClient, executionContext) | ||
def healthCheck(): Action[AnyContent] = | ||
Action { | ||
Ok("OK") | ||
} | ||
|
||
} |
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
34 changes: 0 additions & 34 deletions
34
admin/app/controllers/admin/OAuthLoginAdminController.scala
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,32 +1,24 @@ | ||
package controllers.cache | ||
|
||
import java.net.URI | ||
import com.gu.googleauth.UserIdentity | ||
import common.{GuLogging, ImplicitControllerExecutionContext} | ||
import controllers.admin.AdminAuthController | ||
import model.{ApplicationContext, NoCache} | ||
import org.apache.commons.codec.digest.DigestUtils | ||
import play.api.http.HttpConfiguration | ||
import play.api.libs.ws.WSClient | ||
import play.api.mvc.Security.AuthenticatedRequest | ||
import play.api.mvc._ | ||
import purge.{AjaxHost, CdnPurge, GuardianHost} | ||
|
||
import scala.concurrent.Future | ||
import scala.concurrent.Future.successful | ||
|
||
case class PrePurgeTestResult(url: String, passed: Boolean) | ||
|
||
class PageDecacheController( | ||
wsClient: WSClient, | ||
val controllerComponents: ControllerComponents, | ||
val httpConfiguration: HttpConfiguration, | ||
)(implicit | ||
context: ApplicationContext, | ||
) extends BaseController | ||
with GuLogging | ||
with ImplicitControllerExecutionContext | ||
with AdminAuthController { | ||
with ImplicitControllerExecutionContext { | ||
|
||
def renderPageDecache(): Action[AnyContent] = | ||
Action.async { implicit request => | ||
|
@@ -39,7 +31,7 @@ class PageDecacheController( | |
} | ||
|
||
def decacheAjax(): Action[AnyContent] = | ||
AdminAuthAction(httpConfiguration).async { implicit request => | ||
Action.async { implicit request => | ||
getSubmittedUrlPathMd5(request) match { | ||
case Some(path) => | ||
CdnPurge.soft(wsClient, path, AjaxHost).map(message => NoCache(Ok(views.html.cache.ajaxDecache(message)))) | ||
|
@@ -48,7 +40,7 @@ class PageDecacheController( | |
} | ||
|
||
def decachePage(): Action[AnyContent] = | ||
AdminAuthAction(httpConfiguration).async { implicit request => | ||
Action.async { implicit request => | ||
getSubmittedUrlPathMd5(request) match { | ||
case Some(md5Path) => | ||
CdnPurge | ||
|
@@ -58,13 +50,15 @@ class PageDecacheController( | |
} | ||
} | ||
|
||
private def getSubmittedUrlPathMd5(request: AuthenticatedRequest[AnyContent, UserIdentity]): Option[String] = { | ||
private def getSubmittedUrlPathMd5(request: Request[AnyContent]): Option[String] = { | ||
request.body.asFormUrlEncoded | ||
.getOrElse(Map.empty) | ||
.get("url") | ||
.flatMap(_.headOption) | ||
.map(_.trim) | ||
.map(url => DigestUtils.md5Hex(new URI(url).getPath)) | ||
.map(new URI(_)) | ||
.map(_.getPath) | ||
.map(DigestUtils.md5Hex) | ||
Comment on lines
+59
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unroll please 🧵 👏 |
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0K