All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.connect.spring.internal.AtlassianConnectWebMvcAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 5.1.4
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy