Skip to content

Commit

Permalink
Merge pull request #155 from guardian/fix-creation-of-superfluous-Pan…
Browse files Browse the repository at this point in the history
…DomainAuthSettingsRefresher-instances

Fix creation of superfluous `PanDomainAuthSettingsRefresher` instances, make `panDomainSettings` a `val`
  • Loading branch information
rtyley authored Sep 17, 2024
2 parents 65e1f65 + 61a193c commit 838d429
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ trait AuthActions {
*/
def wsClient: WSClient
def controllerComponents: ControllerComponents
def panDomainSettings: PanDomainAuthSettingsRefresher
val panDomainSettings: PanDomainAuthSettingsRefresher

private def system: String = panDomainSettings.system
private def domain: String = panDomainSettings.domain
private lazy val system: String = panDomainSettings.system
private lazy val domain: String = panDomainSettings.domain
private def settings: PanDomainAuthSettings = panDomainSettings.settings

private implicit val ec: ExecutionContext = controllerComponents.executionContext
Expand Down Expand Up @@ -82,14 +82,14 @@ trait AuthActions {
*/
def authCallbackUrl: String

val OAuth = new OAuth(settings.oAuthSettings, system, authCallbackUrl)(ec, wsClient)
lazy val OAuth = new OAuth(settings.oAuthSettings, system, authCallbackUrl)(ec, wsClient)

/**
* Application name used for initialising Google API clients for directory group checking
*/
val applicationName: String = s"pan-domain-authentication-$system"
lazy val applicationName: String = s"pan-domain-authentication-$system"

val multifactorChecker: Option[Google2FAGroupChecker] = settings.google2FAGroupSettings.map {
lazy val multifactorChecker: Option[Google2FAGroupChecker] = settings.google2FAGroupSettings.map {
new Google2FAGroupChecker(_, panDomainSettings.s3BucketLoader, applicationName)
}

Expand Down

0 comments on commit 838d429

Please sign in to comment.