<div dir="ltr">Hi<div><br></div><div>Why not do it via contructor:</div><div><br></div><div>public AdapterDeploymentContextBean(String configFile){<br></div><div> .....</div><div>}</div><div><br></div><div>and in BasicKeycloakWebSecurityConfigurationAdapter add:</div><div><br></div><div>@Value("${keycloak.configFile:WEB-INF/keycloak.json}")<br></div><div><div>private String keycloakConfigFile;</div></div><div><br></div><div><div>@Bean</div><div>protected AdapterDeploymentContextBean adapterDeploymentContextBean() {</div><div> return new AdapterDeploymentContextBean(keycloakConfigFile);</div><div>}</div></div><div><br></div><div><div style="font-size:13px">Best Regards,</div><div style="font-size:13px"> Andrzej</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-28 22:51 GMT+02:00 Scott Rossillo <span dir="ltr"><<a href="mailto:srossillo@smartling.com" target="_blank">srossillo@smartling.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Based on the other feedback and the Spring way of providing as many configuration options as possible, I think we should refactor AdapterDeploymentContextBean.</div><div><br></div><div>However, I rather like the way Spring that divides behavior up into an interface and multiple implementations. I think we should:</div><div><br></div><div>1. Refactor the current AdapterDeploymentContextBean to be an interface and maybe rename it AdapterDeploymentContextFactory.</div><div>2. Split the current implementation into:</div><div> a. ClasspathAdapterDeploymentContextFactory > loads from class path</div><div> b. WebApplicationAdapterDeploymentContextFactory > loads from WEB-INF</div><div> c. JndiAdapterDeploymentContextFactory > load from JNDI</div><div>3. The above implementations should extend AbtractAdapterDeploymentContextFactory with something like:</div><div><br></div><div><br></div><div>protected loadKeycloakDeployment(Resource resource) {<br> return KeycloakDeploymentBuilder.build(resource.getInputStream());</div><div>}</div><div><br></div><div>That would allow anyone to provide a custom AdapterDeploymentContextFactory to load the keycloak.json from “anywhere."</div><div><br></div><div>What do you think? Since we’re refactoring, I’d also like to take into account design multi-tentant support. I think this approach is flexible enough to add that in the future.</div><div><br></div><div>If we agree this is a good approach you want to take a stab at it Thomas or should I?</div><div><br></div><div>Best,</div><div>Scott</div><div><br></div><br><div>
<div>Scott Rossillo</div><div>Smartling | Senior Software Engineer</div><div><a href="mailto:srossillo@smartling.com" target="_blank">srossillo@smartling.com</a></div><div><br></div><div><a href="https://app.sigstr.com/uc/55e5d41c6533390d03580000" style="color:rgb(0,75,118);font-family:gesta,Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;background-color:rgb(255,255,255);outline:0px!important" target="_blank"><img alt="Latest News + Events" border="0" src="https://app.sigstr.com/uc/55e5d41c6533390d03580000/img" style="border:0px;vertical-align:top;max-width:100%;min-height:auto;width:inherit;color:blue;font-family:Helvetica;font-size:12px"></a><span style="color:rgb(169,169,169);font-family:gesta,Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;background-color:rgb(255,255,255)"></span><div style="color:rgb(169,169,169);font-family:gesta,Arial,Helvetica,sans-serif;font-size:14px;line-height:20px;background-color:rgb(255,255,255)"><a href="http://www.sigstr.com/" style="color:rgb(0,124,194);text-decoration:none;background-color:transparent;outline:0px!important" target="_blank"><img alt="Powered by Sigstr" border="0" src="https://app.sigstr.com/uc/55e5d41c6533390d03580000/watermark" style="border:0px;vertical-align:top;max-width:100%;min-height:auto;width:inherit;color:rgb(99,99,99);font-family:Helvetica;font-size:11px"></a></div></div>
</div>
<br><div><blockquote type="cite"><div><div class="h5"><div>On Sep 25, 2015, at 9:21 AM, Thomas Raehalme <<a href="mailto:thomas.raehalme@aitiofinland.com" target="_blank">thomas.raehalme@aitiofinland.com</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr"><div><div><div><div>Hi!<br><br></div>We have written a custom subclass of org.keycloak.adapters.springsecurity.AdapterDeploymentContextBean to enable custom location for keycloak.json. The use of custom location is optional and defaults to the standard /WEB-INF/keycloak.json.<br><br></div><div>Our use case is that for developers we have a default keycloak.json included in the application. In production, however, we override the default by using a file that is external to the application. The location of the file is specified in JNDI settings and injected to our subclass with the help of Spring.<br><br></div>What do you think would such an extension to AdapterDeploymentContextBean be of general use? I'd be happy to merge our subclass to AdapterDeploymentContextBean and submit a pull request.<br><br></div>Best regards,<br></div>Thomas<br></div></div></div>
_______________________________________________<br>keycloak-dev mailing list<br><a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></div></blockquote></div><br></div><br>_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br></blockquote></div><br></div>