private ClientHttpRequestInterceptor getSecurityInterceptor() { RemoteDevToolsProperties remoteProperties = this.properties.getRemote(); String secretHeaderName = remoteProperties.getSecretHeaderName(); String secret = remoteProperties.getSecret(); Assert.state(secret != null, "The environment value 'spring.devtools.remote.secret' " + "is required to secure your connection."); return new HttpHeaderInterceptor(secretHeaderName, secret); }
@PostConstruct private void logWarnings() { RemoteDevToolsProperties remoteProperties = this.properties.getRemote(); if (!remoteProperties.getDebug().isEnabled() && !remoteProperties.getRestart().isEnabled()) { logger.warn("Remote restart and debug are both disabled."); } if (!this.remoteUrl.startsWith("https://")) { logger.warn("The connection to " + this.remoteUrl + " is insecure. You should use a URL starting with 'https://'."); } }
@Bean public TunnelClient remoteDebugTunnelClient( ClientHttpRequestFactory requestFactory) { RemoteDevToolsProperties remoteProperties = this.properties.getRemote(); String url = this.remoteUrl + remoteProperties.getContextPath() + "/debug"; TunnelConnection connection = new HttpTunnelConnection(url, requestFactory); int localPort = remoteProperties.getDebug().getLocalPort(); TunnelClient client = new TunnelClient(localPort, connection); client.addListener(new LoggingTunnelClientListener()); return client; }
@Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( context.getEnvironment(), "spring.devtools.remote.debug."); Integer port = resolver.getProperty("local-port", Integer.class); if (port == null) { port = RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT; } if (isPortAvailable(port)) { return ConditionOutcome.match("Local debug port available"); } return ConditionOutcome.noMatch("Local debug port unavailable"); }