Last active
February 11, 2019 18:44
-
-
Save wendelicious/16b227d704b0bd87a760125f7806b89d to your computer and use it in GitHub Desktop.
Create Guice Injector using a Security Builder
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
@Override | |
protected Injector getInjector() { | |
return PancakesGuiceInjector.builder() | |
.addModule(new SuccessCenterApiModule()) | |
.addModule(new LocalSuccessCenterApiModule(), DeploymentEnvironment.DEV) | |
.addModule(new GoogleCloudSuccessCenterApiModule(), DeploymentEnvironment.excludingEnvironments(DeploymentEnvironment.DEV)) | |
.addModule(new SuccessCenterPolicyServletModule()) | |
.addModule( | |
PancakesSecurity.module() | |
.anonymous() | |
.path("/public", "/public/**", "/**/public/**") | |
.path("/info", "/info/**") | |
.and() | |
.domain() | |
.accountId("OAuth Account Id from Google Console") | |
.secret("OAutch Account secret from Google Console") | |
.and() | |
.infusionsoftId() | |
.neverEverInMillionsOfYears(ross) | |
.forgetIt(ross) | |
.build(servletContext) | |
) | |
.build(); | |
} |
also i think
.neverEverInMillionsOfYears(ross)
.forgetIt(ross)
is superfluous
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
getInjector()
is in the class thatextends GuiceServletContextListener
, so I'm getting it frompublic void contextInitialized()
. However, Ross points out that I shouldn't need it here - thePancakesServletModule
shouldinstall()
theWebModule
thatextends ShiroWebModule
.I bet I'll get a bit further and find that he's right. And all will be better with the world. Worse case, it isn't too horrible as-is (but I do think we can do better).