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

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

There is a newer version: 5.1.4
Show newest version
package com.atlassian.connect.spring.internal;

import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * Properties for Atlassian Connect add-ons.
 */
@ConfigurationProperties(prefix = "atlassian.connect")
public class AtlassianConnectProperties {

    /**
     * The default order for the JWT authentication filter
     */
    public static final int DEFAULT_JWT_FILTER_ORDER = SecurityProperties.DEFAULT_FILTER_ORDER + 200;

    /**
     * The default order for the Asymmetric authentication filter
     */
    public static final int DEFAULT_ASYMMETRIC_AUTH_FILTER_ORDER = SecurityProperties.DEFAULT_FILTER_ORDER + 190;

    public enum RequestUriEncoding {
        /**
         * Let Spring handles the URI encoding
         */
        DEFAULT,

        /**
         * Pass in a completely encoded URI and skip Spring's uri encoding
         */
        NONE,
    }

    /**
     * Allow choosing preferred URI encoding method
     *
     * 

There have been issues around URIs not being parsed correctly or as expected, * see: ACSPRING-150: RestTemplate not being able to * encode URLs with special characters * *

To address this, "none" can be used as your preferred URI encoding method and this allows the URI passed in * being untouched - when utilising {@code UriComponentsBuilder} along with {@code build(true)}. *


     * UriComponents uriComponents = UriComponentsBuilder.fromUriString(preEncodedUriString).build(true); 
* atlassianHostRestClients.authenticatedAsAddon().getForObject(uriComponents.toUri(), Example.class); *
* * If "none" is not set, it will default to the default behaviour where the URI of URI string passed in will be * encoded, and the result may not be desired. */ private RequestUriEncoding uriEncoding = RequestUriEncoding.DEFAULT; public RequestUriEncoding getUriEncoding() { return uriEncoding; } public void setUriEncoding(RequestUriEncoding uriEncoding) { this.uriEncoding = uriEncoding; } /** * Accept installations signed by an unknown host. (Useful in development mode using an in-memory database.) */ private boolean allowReinstallMissingHost = false; /** * Enable debug mode for the JavaScript API, loading all-debug.js instead of all.js. */ private boolean debugAllJs = false; /** * The order of the JWT authentication filter in the chain. */ private Integer jwtFilterOrder = DEFAULT_JWT_FILTER_ORDER; /** * Base URL to retrieve public keys used to verify signed install hooks */ private String publicKeyBaseUrl; /** * The order of the asymmetric JWT authentication filter in the chain. */ private Integer asymmetricAuthFilterOrder = DEFAULT_ASYMMETRIC_AUTH_FILTER_ORDER; public String getPublicKeyBaseUrl() { return publicKeyBaseUrl; } public void setPublicKeyBaseUrl(String publicKeyBaseUrl) { this.publicKeyBaseUrl = publicKeyBaseUrl; } public Integer getAsymmetricAuthFilterOrder() { return asymmetricAuthFilterOrder; } public void setAsymmetricAuthFilterOrder(Integer asymmetricAuthFilterOrder) { this.asymmetricAuthFilterOrder = asymmetricAuthFilterOrder; } /** * Expiration time for JSON Web Tokens in seconds. */ private Integer jwtExpirationTime = 180; /** * Expiration time for self-authentication tokens in seconds. */ private Integer selfAuthenticationExpirationTime = 900; /** * URL path patterns for which authentication should be required. */ private List requireAuthIncludePaths = new ArrayList<>(); /** * URL path patterns for which authentication should not be required. */ private List requireAuthExcludePaths = new ArrayList<>(); /** * Request timeout for /installed lifecycle callback in seconds. * (If raising above the default, be sure to stay below the host's timeout value.) */ private Integer installTimeout = 3; /** * Sets up a default redirection for the root of the application to the add-on descriptor resource. * Can be disabled if you need to serve e.g a "welcome page" at the root of your application. */ private boolean redirectRootToDescriptor = true; public boolean isAllowReinstallMissingHost() { return allowReinstallMissingHost; } public void setAllowReinstallMissingHost(boolean allowReinstallMissingHost) { this.allowReinstallMissingHost = allowReinstallMissingHost; } public boolean isDebugAllJs() { return debugAllJs; } public void setDebugAllJs(boolean debugAllJs) { this.debugAllJs = debugAllJs; } public Integer getJwtFilterOrder() { return jwtFilterOrder; } public void setJwtFilterOrder(Integer jwtFilterOrder) { this.jwtFilterOrder = jwtFilterOrder; } public Integer getJwtExpirationTime() { return jwtExpirationTime; } public void setJwtExpirationTime(Integer jwtExpirationTime) { this.jwtExpirationTime = jwtExpirationTime; } public Integer getSelfAuthenticationExpirationTime() { return selfAuthenticationExpirationTime; } public void setSelfAuthenticationExpirationTime(Integer selfAuthenticationExpirationTime) { this.selfAuthenticationExpirationTime = selfAuthenticationExpirationTime; } public List getRequireAuthIncludePaths() { return requireAuthIncludePaths; } public void setRequireAuthIncludePaths(List requireAuthIncludePaths) { this.requireAuthIncludePaths = requireAuthIncludePaths; } public List getRequireAuthExcludePaths() { return requireAuthExcludePaths; } public void setRequireAuthExcludePaths(List requireAuthExcludePaths) { this.requireAuthExcludePaths = requireAuthExcludePaths; } public Integer getInstallTimeout() { return installTimeout; } public void setInstallTimeout(Integer installTimeout) { this.installTimeout = installTimeout; } public boolean isRedirectRootToDescriptor() { return redirectRootToDescriptor; } public void setRedirectRootToDescriptor(boolean redirectRootToDescriptor) { this.redirectRootToDescriptor = redirectRootToDescriptor; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy