com.atlassian.connect.spring.internal.AtlassianConnectWebMvcAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atlassian-connect-spring-boot-core Show documentation
Show all versions of atlassian-connect-spring-boot-core Show documentation
Provides the core of Atlassian Connect for Spring Boot
package com.atlassian.connect.spring.internal;
import com.atlassian.connect.spring.internal.auth.RequireAuthenticationHandlerInterceptor;
import com.atlassian.connect.spring.internal.descriptor.AddonDescriptorLoader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* A Spring Web MVC configuration class, providing custom functionality for Atlassian Connect.
*/
@Configuration
@ConditionalOnResource(resources = AddonDescriptorLoader.DESCRIPTOR_RESOURCE_PATH)
public class AtlassianConnectWebMvcAutoConfiguration implements WebMvcConfigurer {
@Autowired
private AtlassianConnectProperties atlassianConnectProperties;
@Autowired
private RequireAuthenticationHandlerInterceptor requireAuthenticationHandlerInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(requireAuthenticationHandlerInterceptor)
.addPathPatterns(atlassianConnectProperties.getRequireAuthIncludePaths())
.excludePathPatterns(atlassianConnectProperties.getRequireAuthExcludePaths());
}
}