Skip to content

Commit

Permalink
ensure delegated clients can be reloaded on change
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Jul 18, 2019
1 parent d315604 commit 1d5ff12
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import lombok.Getter;
import lombok.ToString;
import lombok.val;

import java.nio.file.Path;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -68,6 +69,7 @@ public boolean isEligibleForContextRefresh() {
if (this.override) {
return true;
}
return getFile() != null && CONFIG_FILE_PATTERN.matcher(getFile().toFile().getName()).find();
val fileName = getFile().toFile().getName();
return getFile() != null && CONFIG_FILE_PATTERN.matcher(fileName).find();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -37,7 +36,6 @@ public class CasCoreBootstrapStandaloneWatchConfiguration {
private ObjectProvider<CasConfigurationPropertiesEnvironmentManager> configurationPropertiesEnvironmentManager;

@ConditionalOnProperty(value = "cas.events.trackConfigurationModifications", havingValue = "true")
@RefreshScope
@Bean
public CasConfigurationWatchService casConfigurationWatchService() {
return new CasConfigurationWatchService(configurationPropertiesEnvironmentManager.getIfAvailable(), eventPublisher);
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ reflectionsVersion=0.9.11
guavaVersion=28.0-jre

pac4jSpringWebmvcVersion=3.3.0-SNAPSHOT
pac4jVersion=4.0.0-SNAPSHOT
pac4jVersion=4.0.0-RC1

statsdVersion=3.1.0
amazonSdkVersion=1.11.589
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public View redirectToProvider(final HttpServletRequest request, final HttpServl
throw new UnauthorizedServiceException("Unable to locate client " + clientName);
}
val client = IndirectClient.class.cast(clientResult.get());
client.init();
val webContext = new JEEContext(request, response, this.sessionStore);
val ticket = delegatedClientWebflowManager.store(webContext, client);

Expand All @@ -108,7 +109,8 @@ public View redirectToProvider(final HttpServletRequest request, final HttpServl
*/
@RequestMapping(value = ENDPOINT_RESPONSE, method = {RequestMethod.GET, RequestMethod.POST})
public View redirectResponseToFlow(@PathVariable("clientName") final String clientName,
final HttpServletRequest request, final HttpServletResponse response) {
final HttpServletRequest request,
final HttpServletResponse response) {
return buildRedirectViewBackToFlow(clientName, request);
}

Expand Down Expand Up @@ -146,6 +148,7 @@ protected View buildRedirectViewBackToFlow(final String clientName, final HttpSe
*/
@SneakyThrows
protected View getResultingView(final IndirectClient<Credentials> client, final JEEContext webContext, final Ticket ticket) {
client.init();
val actionResult = client.getRedirectionActionBuilder().redirect(webContext);
if (actionResult.isPresent()) {
val action = actionResult.get();
Expand Down

0 comments on commit 1d5ff12

Please sign in to comment.