/*** ** * ** * * ** * * * * Copyright 2019-2022 the original author or authors.* * * * ** * * * * Licensed under the Apache License, Version 2.0 (the "License");* * * * * you may not use this file except in compliance with the License.* * * * * You may obtain a copy of the License at* * * * ** * * * * https://www.apache.org/licenses/LICENSE-2.0* * * * ** * * * * Unless required by applicable law or agreed to in writing, software* * * * * distributed under the License is distributed on an "AS IS" BASIS,* * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* * * * * See the License for the specific language governing permissions and* * * * * limitations under the License.* * * ** * ** ***/packageorg.springdoc.core.properties;importjava.util.Set;importjava.util.stream.Collectors;importorg.apache.commons.lang3.StringUtils;importorg.springdoc.core.configuration.SpringDocConfiguration;importorg.springdoc.core.utils.Constants;importorg.springframework.boot.autoconfigure.condition.ConditionalOnBean;importorg.springframework.boot.autoconfigure.condition.ConditionalOnProperty;importorg.springframework.boot.context.properties.ConfigurationProperties;importorg.springframework.context.annotation.Configuration;importorg.springframework.context.annotation.Lazy;importstaticorg.springdoc.core.utils.Constants.SPRINGDOC_SWAGGER_UI_ENABLED;/*** The type Swagger ui config properties.* @author bnasslahsen*/@Lazy(false)@Configuration(proxyBeanMethods =false)@ConfigurationProperties(prefix ="springdoc.swagger-ui")@ConditionalOnProperty(name =SPRINGDOC_SWAGGER_UI_ENABLED, matchIfMissing =true)@ConditionalOnBean(SpringDocConfiguration.class)publicclassSwaggerUiConfigPropertiesextendsAbstractSwaggerUiConfigProperties{/*** The Disable swagger default url.*/privateboolean disableSwaggerDefaultUrl;/*** The Swagger ui version.*/privateString version;/*** The Csrf configuration.*/privateCsrf csrf =newCsrf();/*** The Syntax Highlight configuration.*/privateSyntaxHighlight syntaxHighlight =newSyntaxHighlight();/*** Whether to generate and serve an OpenAPI document.*/privateboolean enabled =true;/*** The Use root path.*/privateboolean useRootPath;/*** Gets swagger ui version.** @return the swagger ui version*/publicStringgetVersion(){return version;}/*** Sets swagger ui version.** @param version the swagger ui version*/publicvoidsetVersion(String version){this.version = version;}/*** Is use root path boolean.** @return the boolean*/publicbooleanisUseRootPath(){return useRootPath;}/*** Sets use root path.** @param useRootPath the use root path*/publicvoidsetUseRootPath(boolean useRootPath){this.useRootPath = useRootPath;}/*** Is enabled boolean.** @return the boolean*/publicbooleanisEnabled(){return enabled;}/*** Sets enabled.** @param enabled the enabled*/publicvoidsetEnabled(boolean enabled){this.enabled = enabled;}/*** Is disable swagger default url boolean.** @return the boolean*/publicbooleanisDisableSwaggerDefaultUrl(){return disableSwaggerDefaultUrl;}/*** Sets disable swagger default url.** @param disableSwaggerDefaultUrl the disable swagger default url*/publicvoidsetDisableSwaggerDefaultUrl(boolean disableSwaggerDefaultUrl){this.disableSwaggerDefaultUrl = disableSwaggerDefaultUrl;}/*** Gets csrf.** @return the csrf*/publicCsrfgetCsrf(){return csrf;}/*** Sets csrf.** @param csrf the csrf*/publicvoidsetCsrf(Csrf csrf){this.csrf = csrf;}/*** Is csrf enabled boolean.** @return the boolean*/publicbooleanisCsrfEnabled(){return csrf.isEnabled();}/*** Gets syntaxHighlight.** @return the syntaxHighlight*/publicSyntaxHighlightgetSyntaxHighlight(){return syntaxHighlight;}/*** Sets syntaxHighlight.** @param syntaxHighlight the syntaxHighlight*/publicvoidsetSyntaxHighlight(SyntaxHighlight syntaxHighlight){this.syntaxHighlight = syntaxHighlight;}/*** Clone urls set.** @return the set*/publicSet<SwaggerUrl>cloneUrls(){returnthis.urls.stream().map(swaggerUrl ->newSwaggerUrl(swaggerUrl.getName(), swaggerUrl.getUrl(), swaggerUrl.getDisplayName())).collect(Collectors.toSet());}/*** The type Csrf.* @author bnasslashen*/publicstaticclassCsrf{/*** The Enabled.*/privateboolean enabled;/*** Use Local storage.*/privateboolean useLocalStorage;/*** Use Session storage.*/privateboolean useSessionStorage;/*** The Cookie name.*/privateString cookieName =Constants.CSRF_DEFAULT_COOKIE_NAME;/*** The Local storage key.*/privateString localStorageKey =Constants.CSRF_DEFAULT_LOCAL_STORAGE_KEY;/*** The Session storage key.*/privateString sessionStorageKey =Constants.CSRF_DEFAULT_LOCAL_STORAGE_KEY;/*** The Header name.*/privateString headerName =Constants.CSRF_DEFAULT_HEADER_NAME;/*** Is enabled boolean.** @return the boolean*/publicbooleanisEnabled(){return enabled;}/*** Sets enabled.** @param enabled the enabled*/publicvoidsetEnabled(boolean enabled){this.enabled = enabled;}/*** Use Local storage boolean.** @return the boolean*/publicbooleanisUseLocalStorage(){return useLocalStorage;}/*** Sets useLocalStorage.** @param useLocalStorage the use local storage*/publicvoidsetUseLocalStorage(boolean useLocalStorage){this.useLocalStorage = useLocalStorage;}/*** Use Session storage boolean.** @return the boolean*/publicbooleanisUseSessionStorage(){return useSessionStorage;}/*** Sets useSessionStorage.** @param useSessionStorage the use local storage*/publicvoidsetUseSessionStorage(boolean useSessionStorage){this.useSessionStorage = useSessionStorage;}/*** Gets cookie name.** @return the cookie name*/publicStringgetCookieName(){return cookieName;}/*** Sets cookie name.** @param cookieName the cookie name*/publicvoidsetCookieName(String cookieName){this.cookieName = cookieName;}/*** Gets local storage key.** @return the cookie name*/publicStringgetLocalStorageKey(){return localStorageKey;}/*** Sets local storage key.** @param localStorageKey the local storage key*/publicvoidsetLocalStorageKey(String localStorageKey){this.localStorageKey = localStorageKey;}/*** Gets session storage key.** @return the cookie name*/publicStringgetSessionStorageKey(){return sessionStorageKey;}/*** Sets local storage key.** @param sessionStorageKey the local storage key*/publicvoidsetSessionStorageKey(String sessionStorageKey){this.sessionStorageKey = sessionStorageKey;}/*** Gets header name.** @return the header name*/publicStringgetHeaderName(){return headerName;}/*** Sets header name.** @param headerName the header name*/publicvoidsetHeaderName(String headerName){this.headerName = headerName;}}/*** The type Syntax highlight.* @author bnasslashen*/publicstaticclassSyntaxHighlight{/*** The Activated.*/privateBoolean activated;/*** The Theme.*/privateString theme;/*** Gets activated.** @return the activated*/publicBooleangetActivated(){return activated;}/*** Sets activated.** @param activated the activated*/publicvoidsetActivated(Boolean activated){this.activated = activated;}/*** Gets theme.** @return the theme*/publicStringgetTheme(){return theme;}/*** Sets theme.** @param theme the theme*/publicvoidsetTheme(String theme){this.theme = theme;}/*** Is present boolean.** @return the boolean*/publicbooleanisPresent(){return activated !=null||StringUtils.isNotEmpty(theme);}}}