repo_name
stringclasses
5 values
pr_number
int64
1.52k
15.5k
pr_title
stringlengths
8
143
pr_description
stringlengths
0
10.2k
author
stringlengths
3
18
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
11
10.2k
filepath
stringlengths
6
220
before_content
stringlengths
0
597M
after_content
stringlengths
0
597M
label
int64
-1
1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/javaConfigDemo/AnnotationApplication.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.demo.spring.javaConfigDemo; import com.ctrip.framework.apollo.demo.spring.common.bean.AnnotatedBean; import com.google.common.base.Charsets; import com.google.common.base.Strings; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; /** * @author Jason Song([email protected]) */ public class AnnotationApplication { public static void main(String[] args) throws IOException { ApplicationContext context = new AnnotationConfigApplicationContext("com.ctrip.framework.apollo.demo.spring.common"); AnnotatedBean annotatedBean = context.getBean(AnnotatedBean.class); System.out.println("AnnotationApplication Demo. Input any key except quit to print the values. Input quit to exit."); while (true) { System.out.print("> "); String input = new BufferedReader(new InputStreamReader(System.in, Charsets.UTF_8)).readLine(); if (!Strings.isNullOrEmpty(input) && input.trim().equalsIgnoreCase("quit")) { System.exit(0); } System.out.println(annotatedBean.toString()); } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.demo.spring.javaConfigDemo; import com.ctrip.framework.apollo.demo.spring.common.bean.AnnotatedBean; import com.google.common.base.Charsets; import com.google.common.base.Strings; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; /** * @author Jason Song([email protected]) */ public class AnnotationApplication { public static void main(String[] args) throws IOException { ApplicationContext context = new AnnotationConfigApplicationContext("com.ctrip.framework.apollo.demo.spring.common"); AnnotatedBean annotatedBean = context.getBean(AnnotatedBean.class); System.out.println("AnnotationApplication Demo. Input any key except quit to print the values. Input quit to exit."); while (true) { System.out.print("> "); String input = new BufferedReader(new InputStreamReader(System.in, Charsets.UTF_8)).readLine(); if (!Strings.isNullOrEmpty(input) && input.trim().equalsIgnoreCase("quit")) { System.exit(0); } System.out.println(annotatedBean.toString()); } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.spi.ConfigRegistry; import com.ctrip.framework.apollo.spi.DefaultConfigFactory; import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager; import com.ctrip.framework.apollo.spi.DefaultConfigRegistry; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.DefaultHttpClient; import com.ctrip.framework.apollo.util.http.HttpClient; import com.ctrip.framework.apollo.util.yaml.YamlParser; import com.ctrip.framework.foundation.internals.ServiceBootstrap; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Singleton; import java.util.List; /** * Guice injector * @author Jason Song([email protected]) */ public class DefaultInjector implements Injector { private final com.google.inject.Injector m_injector; private final List<ApolloInjectorCustomizer> m_customizers; public DefaultInjector() { try { m_injector = Guice.createInjector(new ApolloModule()); m_customizers = ServiceBootstrap.loadAllOrdered(ApolloInjectorCustomizer.class); } catch (Throwable ex) { ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex); Tracer.logError(exception); throw exception; } } @Override public <T> T getInstance(Class<T> clazz) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz); if (instance != null) { return instance; } } return m_injector.getInstance(clazz); } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s!", clazz.getName()), ex); } } @Override public <T> T getInstance(Class<T> clazz, String name) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz, name); if (instance != null) { return instance; } } //Guice does not support get instance by type and name return null; } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s with name %s!", clazz.getName(), name), ex); } } private static class ApolloModule extends AbstractModule { @Override protected void configure() { bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class); bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class); bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class); bind(ConfigFactory.class).to(DefaultConfigFactory.class).in(Singleton.class); bind(ConfigUtil.class).in(Singleton.class); bind(HttpClient.class).to(DefaultHttpClient.class).in(Singleton.class); bind(ConfigServiceLocator.class).in(Singleton.class); bind(RemoteConfigLongPollService.class).in(Singleton.class); bind(YamlParser.class).in(Singleton.class); bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class); } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.spi.ConfigRegistry; import com.ctrip.framework.apollo.spi.DefaultConfigFactory; import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager; import com.ctrip.framework.apollo.spi.DefaultConfigRegistry; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.DefaultHttpClient; import com.ctrip.framework.apollo.util.http.HttpClient; import com.ctrip.framework.apollo.util.yaml.YamlParser; import com.ctrip.framework.foundation.internals.ServiceBootstrap; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Singleton; import java.util.List; /** * Guice injector * @author Jason Song([email protected]) */ public class DefaultInjector implements Injector { private final com.google.inject.Injector m_injector; private final List<ApolloInjectorCustomizer> m_customizers; public DefaultInjector() { try { m_injector = Guice.createInjector(new ApolloModule()); m_customizers = ServiceBootstrap.loadAllOrdered(ApolloInjectorCustomizer.class); } catch (Throwable ex) { ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex); Tracer.logError(exception); throw exception; } } @Override public <T> T getInstance(Class<T> clazz) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz); if (instance != null) { return instance; } } return m_injector.getInstance(clazz); } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s!", clazz.getName()), ex); } } @Override public <T> T getInstance(Class<T> clazz, String name) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz, name); if (instance != null) { return instance; } } //Guice does not support get instance by type and name return null; } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s with name %s!", clazz.getName(), name), ex); } } private static class ApolloModule extends AbstractModule { @Override protected void configure() { bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class); bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class); bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class); bind(ConfigFactory.class).to(DefaultConfigFactory.class).in(Singleton.class); bind(ConfigUtil.class).in(Singleton.class); bind(HttpClient.class).to(DefaultHttpClient.class).in(Singleton.class); bind(ConfigServiceLocator.class).in(Singleton.class); bind(RemoteConfigLongPollService.class).in(Singleton.class); bind(YamlParser.class).in(Singleton.class); bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class); } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "Namespace") @SQLDelete(sql = "Update Namespace set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Namespace extends BaseEntity { @Column(name = "appId", nullable = false) private String appId; @Column(name = "ClusterName", nullable = false) private String clusterName; @Column(name = "NamespaceName", nullable = false) private String namespaceName; public Namespace(){ } public Namespace(String appId, String clusterName, String namespaceName) { this.appId = appId; this.clusterName = clusterName; this.namespaceName = namespaceName; } public String getAppId() { return appId; } public String getClusterName() { return clusterName; } public String getNamespaceName() { return namespaceName; } public void setAppId(String appId) { this.appId = appId; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public void setNamespaceName(String namespaceName) { this.namespaceName = namespaceName; } public String toString() { return toStringHelper().add("appId", appId).add("clusterName", clusterName) .add("namespaceName", namespaceName).toString(); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "Namespace") @SQLDelete(sql = "Update Namespace set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Namespace extends BaseEntity { @Column(name = "appId", nullable = false) private String appId; @Column(name = "ClusterName", nullable = false) private String clusterName; @Column(name = "NamespaceName", nullable = false) private String namespaceName; public Namespace(){ } public Namespace(String appId, String clusterName, String namespaceName) { this.appId = appId; this.clusterName = clusterName; this.namespaceName = namespaceName; } public String getAppId() { return appId; } public String getClusterName() { return clusterName; } public String getNamespaceName() { return namespaceName; } public void setAppId(String appId) { this.appId = appId; } public void setClusterName(String clusterName) { this.clusterName = clusterName; } public void setNamespaceName(String namespaceName) { this.namespaceName = namespaceName; } public String toString() { return toStringHelper().add("appId", appId).add("clusterName", clusterName) .add("namespaceName", namespaceName).toString(); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigRepository.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; /** * @author Jason Song([email protected]) */ public interface ConfigRepository { /** * Get the config from this repository. * @return config */ Properties getConfig(); /** * Set the fallback repo for this repository. * @param upstreamConfigRepository the upstream repo */ void setUpstreamRepository(ConfigRepository upstreamConfigRepository); /** * Add change listener. * @param listener the listener to observe the changes */ void addChangeListener(RepositoryChangeListener listener); /** * Remove change listener. * @param listener the listener to remove */ void removeChangeListener(RepositoryChangeListener listener); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type */ ConfigSourceType getSourceType(); }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; /** * @author Jason Song([email protected]) */ public interface ConfigRepository { /** * Get the config from this repository. * @return config */ Properties getConfig(); /** * Set the fallback repo for this repository. * @param upstreamConfigRepository the upstream repo */ void setUpstreamRepository(ConfigRepository upstreamConfigRepository); /** * Add change listener. * @param listener the listener to observe the changes */ void addChangeListener(RepositoryChangeListener listener); /** * Remove change listener. * @param listener the listener to remove */ void removeChangeListener(RepositoryChangeListener listener); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type */ ConfigSourceType getSourceType(); }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client-config-data/src/main/java/com/ctrip/framework/apollo/config/data/extension/webclient/customizer/spi/ApolloClientWebClientCustomizerFactory.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.config.data.extension.webclient.customizer.spi; import com.ctrip.framework.apollo.config.data.extension.properties.ApolloClientProperties; import com.ctrip.framework.apollo.core.spi.Ordered; import org.apache.commons.logging.Log; import org.springframework.boot.ConfigurableBootstrapContext; import org.springframework.boot.context.properties.bind.BindHandler; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.web.reactive.function.client.WebClientCustomizer; import org.springframework.lang.Nullable; /** * @author vdisk <[email protected]> */ public interface ApolloClientWebClientCustomizerFactory extends Ordered { /** * create a WebClientCustomizer instance * * @param apolloClientProperties apollo client binded properties * @param binder properties binder * @param bindHandler properties binder Handler * @param log deferred log * @param bootstrapContext bootstrapContext * @return WebClientCustomizer instance or null */ @Nullable WebClientCustomizer createWebClientCustomizer(ApolloClientProperties apolloClientProperties, Binder binder, BindHandler bindHandler, Log log, ConfigurableBootstrapContext bootstrapContext); }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.config.data.extension.webclient.customizer.spi; import com.ctrip.framework.apollo.config.data.extension.properties.ApolloClientProperties; import com.ctrip.framework.apollo.core.spi.Ordered; import org.apache.commons.logging.Log; import org.springframework.boot.ConfigurableBootstrapContext; import org.springframework.boot.context.properties.bind.BindHandler; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.web.reactive.function.client.WebClientCustomizer; import org.springframework.lang.Nullable; /** * @author vdisk <[email protected]> */ public interface ApolloClientWebClientCustomizerFactory extends Ordered { /** * create a WebClientCustomizer instance * * @param apolloClientProperties apollo client binded properties * @param binder properties binder * @param bindHandler properties binder Handler * @param log deferred log * @param bootstrapContext bootstrapContext * @return WebClientCustomizer instance or null */ @Nullable WebClientCustomizer createWebClientCustomizer(ApolloClientProperties apolloClientProperties, Binder binder, BindHandler bindHandler, Log log, ConfigurableBootstrapContext bootstrapContext); }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client-config-data/src/main/java/com/ctrip/framework/apollo/config/data/extension/webclient/injector/ApolloClientCustomHttpClientInjectorCustomizer.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.config.data.extension.webclient.injector; import com.ctrip.framework.apollo.config.data.extension.webclient.ApolloWebClientHttpClient; import com.ctrip.framework.apollo.core.spi.Ordered; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import org.springframework.web.reactive.function.client.WebClient; /** * @author vdisk <[email protected]> */ public class ApolloClientCustomHttpClientInjectorCustomizer implements ApolloInjectorCustomizer { /** * the order of the injector customizer */ public static final int ORDER = Ordered.LOWEST_PRECEDENCE - 100; private static ApolloWebClientHttpClient CUSTOM_HTTP_CLIENT; /** * set the webClient to use * * @param webClient webClient to use */ public static void setCustomWebClient(WebClient webClient) { CUSTOM_HTTP_CLIENT = new ApolloWebClientHttpClient(webClient); } @SuppressWarnings("unchecked") @Override public <T> T getInstance(Class<T> clazz) { if (clazz.isInstance(CUSTOM_HTTP_CLIENT)) { return (T) CUSTOM_HTTP_CLIENT; } return null; } @Override public <T> T getInstance(Class<T> clazz, String name) { return null; } @Override public int getOrder() { return ORDER; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.config.data.extension.webclient.injector; import com.ctrip.framework.apollo.config.data.extension.webclient.ApolloWebClientHttpClient; import com.ctrip.framework.apollo.core.spi.Ordered; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import org.springframework.web.reactive.function.client.WebClient; /** * @author vdisk <[email protected]> */ public class ApolloClientCustomHttpClientInjectorCustomizer implements ApolloInjectorCustomizer { /** * the order of the injector customizer */ public static final int ORDER = Ordered.LOWEST_PRECEDENCE - 100; private static ApolloWebClientHttpClient CUSTOM_HTTP_CLIENT; /** * set the webClient to use * * @param webClient webClient to use */ public static void setCustomWebClient(WebClient webClient) { CUSTOM_HTTP_CLIENT = new ApolloWebClientHttpClient(webClient); } @SuppressWarnings("unchecked") @Override public <T> T getInstance(Class<T> clazz) { if (clazz.isInstance(CUSTOM_HTTP_CLIENT)) { return (T) CUSTOM_HTTP_CLIENT; } return null; } @Override public <T> T getInstance(Class<T> clazz, String name) { return null; } @Override public int getOrder() { return ORDER; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/BizLoggingCustomizer.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.ctrip; import com.ctrip.framework.apollo.common.customize.LoggingCustomizer; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @Component @Profile("ctrip") public class BizLoggingCustomizer extends LoggingCustomizer { private final PortalConfig portalConfig; public BizLoggingCustomizer(final PortalConfig portalConfig) { this.portalConfig = portalConfig; } @Override protected String cloggingUrl() { return portalConfig.cloggingUrl(); } @Override protected String cloggingPort() { return portalConfig.cloggingPort(); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.ctrip; import com.ctrip.framework.apollo.common.customize.LoggingCustomizer; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @Component @Profile("ctrip") public class BizLoggingCustomizer extends LoggingCustomizer { private final PortalConfig portalConfig; public BizLoggingCustomizer(final PortalConfig portalConfig) { this.portalConfig = portalConfig; } @Override protected String cloggingUrl() { return portalConfig.cloggingUrl(); } @Override protected String cloggingPort() { return portalConfig.cloggingPort(); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.constant.TracerEventType; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.tracer.Tracer; import org.springframework.stereotype.Service; import java.util.List; @Service public class ClusterService { private final UserInfoHolder userInfoHolder; private final AdminServiceAPI.ClusterAPI clusterAPI; public ClusterService(final UserInfoHolder userInfoHolder, final AdminServiceAPI.ClusterAPI clusterAPI) { this.userInfoHolder = userInfoHolder; this.clusterAPI = clusterAPI; } public List<ClusterDTO> findClusters(Env env, String appId) { return clusterAPI.findClustersByApp(appId, env); } public ClusterDTO createCluster(Env env, ClusterDTO cluster) { if (!clusterAPI.isClusterUnique(cluster.getAppId(), env, cluster.getName())) { throw new BadRequestException(String.format("cluster %s already exists.", cluster.getName())); } ClusterDTO clusterDTO = clusterAPI.create(env, cluster); Tracer.logEvent(TracerEventType.CREATE_CLUSTER, cluster.getAppId(), "0", cluster.getName()); return clusterDTO; } public void deleteCluster(Env env, String appId, String clusterName){ clusterAPI.delete(env, appId, clusterName, userInfoHolder.getUser().getUserId()); } public ClusterDTO loadCluster(String appId, Env env, String clusterName){ return clusterAPI.loadCluster(appId, env, clusterName); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.constant.TracerEventType; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.tracer.Tracer; import org.springframework.stereotype.Service; import java.util.List; @Service public class ClusterService { private final UserInfoHolder userInfoHolder; private final AdminServiceAPI.ClusterAPI clusterAPI; public ClusterService(final UserInfoHolder userInfoHolder, final AdminServiceAPI.ClusterAPI clusterAPI) { this.userInfoHolder = userInfoHolder; this.clusterAPI = clusterAPI; } public List<ClusterDTO> findClusters(Env env, String appId) { return clusterAPI.findClustersByApp(appId, env); } public ClusterDTO createCluster(Env env, ClusterDTO cluster) { if (!clusterAPI.isClusterUnique(cluster.getAppId(), env, cluster.getName())) { throw new BadRequestException(String.format("cluster %s already exists.", cluster.getName())); } ClusterDTO clusterDTO = clusterAPI.create(env, cluster); Tracer.logEvent(TracerEventType.CREATE_CLUSTER, cluster.getAppId(), "0", cluster.getName()); return clusterDTO; } public void deleteCluster(Env env, String appId, String clusterName){ clusterAPI.delete(env, appId, clusterName, userInfoHolder.getUser().getUserId()); } public ClusterDTO loadCluster(String appId, Env env, String clusterName){ return clusterAPI.loadCluster(appId, env, clusterName); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-openapi/src/main/java/com/ctrip/framework/apollo/openapi/dto/OpenClusterDTO.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.openapi.dto; public class OpenClusterDTO extends BaseDTO { private String name; private String appId; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } @Override public String toString() { return "OpenClusterDTO{" + "name='" + name + '\'' + ", appId='" + appId + '\'' + ", dataChangeCreatedBy='" + dataChangeCreatedBy + '\'' + ", dataChangeLastModifiedBy='" + dataChangeLastModifiedBy + '\'' + ", dataChangeCreatedTime=" + dataChangeCreatedTime + ", dataChangeLastModifiedTime=" + dataChangeLastModifiedTime + '}'; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.openapi.dto; public class OpenClusterDTO extends BaseDTO { private String name; private String appId; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } @Override public String toString() { return "OpenClusterDTO{" + "name='" + name + '\'' + ", appId='" + appId + '\'' + ", dataChangeCreatedBy='" + dataChangeCreatedBy + '\'' + ", dataChangeLastModifiedBy='" + dataChangeLastModifiedBy + '\'' + ", dataChangeCreatedTime=" + dataChangeCreatedTime + ", dataChangeLastModifiedTime=" + dataChangeLastModifiedTime + '}'; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/EmailService.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi; import com.ctrip.framework.apollo.portal.entity.bo.Email; public interface EmailService { void send(Email email); }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi; import com.ctrip.framework.apollo.portal.entity.bo.Email; public interface EmailService { void send(Email email); }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/usage/apollo-open-api-platform.md
### 一、 什么是开放平台? Apollo提供了一套的Http REST接口,使第三方应用能够自己管理配置。虽然Apollo系统本身提供了Portal来管理配置,但是在有些情景下,应用需要通过程序去管理配置。 ### 二、 第三方应用接入Apollo开放平台 #### 2.1 注册第三方应用 第三方应用负责人需要向Apollo管理员提供一些第三方应用基本信息。 基本信息如下: * 第三方应用的AppId、应用名、部门 * 第三方应用负责人 Apollo管理员在 http://{portal_address}/open/manage.html 创建第三方应用,创建之前最好先查询此AppId是否已经创建。创建成功之后会生成一个token,如下图所示: ![开放平台管理](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/apollo-open-manage.png) #### 2.2 给已注册的第三方应用授权 第三方应用不应该能操作任何Namespace的配置,所以需要给token绑定可以操作的Namespace。Apollo管理员在 http://{portal_address}/open/manage.html 页面给token赋权。赋权之后,第三方应用就可以通过Apollo提供的Http REST接口来管理已授权的Namespace的配置了。 #### 2.3 第三方应用调用Apollo Open API ##### 2.3.1 调用Http REST接口 任何语言的第三方应用都可以调用Apollo的Open API,在调用接口时,需要设置注意以下两点: * Http Header中增加一个Authorization字段,字段值为申请的token * Http Header的Content-Type字段需要设置成application/json;charset=UTF-8 ##### 2.3.2 Java应用通过apollo-openapi调用Apollo Open API 从1.1.0版本开始,Apollo提供了[apollo-openapi](https://github.com/ctripcorp/apollo/tree/master/apollo-openapi)客户端,所以Java语言的第三方应用可以更方便地调用Apollo Open API。 首先引入`apollo-openapi`依赖: ```xml <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-openapi</artifactId> <version>1.7.0</version> </dependency> ``` 在程序中构造`ApolloOpenApiClient`: ```java String portalUrl = "http://localhost:8070"; // portal url String token = "e16e5cd903fd0c97a116c873b448544b9d086de9"; // 申请的token ApolloOpenApiClient client = ApolloOpenApiClient.newBuilder() .withPortalUrl(portalUrl) .withToken(token) .build(); ``` 后续就可以通过`ApolloOpenApiClient`的接口直接操作Apollo Open API了,接口说明参见下面的Rest接口文档。 ##### 2.3.3 .Net core应用调用Apollo Open API .Net core也提供了open api的客户端,详见https://github.com/ctripcorp/apollo.net/pull/77 ### 三、 接口文档 #### 3.1 URL路径参数说明 参数名 | 参数说明 --- | --- env | 所管理的配置环境 appId | 所管理的配置AppId clusterName | 所管理的配置集群名, 一般情况下传入 default 即可。如果是特殊集群,传入相应集群的名称即可 namespaceName | 所管理的Namespace的名称,如果是非properties格式,需要加上后缀名,如`sample.yml` #### 3.2 API接口列表 ##### 3.2.1 获取App的环境,集群信息 * **URL** : http://{portal_address}/openapi/v1/apps/{appId}/envclusters * **Method** : GET * **Request Params** : 无 * **返回值Sample**: ``` json [ { "env":"FAT", "clusters":[ //集群列表 "default", "FAT381" ] }, { "env":"UAT", "clusters":[ "default" ] }, { "env":"PRO", "clusters":[ "default", "SHAOY", "SHAJQ" ] } ] ``` ##### 3.2.2 获取App信息 * **URL** : http://{portal_address}/openapi/v1/apps * **Method** : GET * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- appIds | false | String | appId列表,以逗号分隔,如果为空则返回所有App信息 * **返回值Sample**: ``` json [ { "name":"first_app", "appId":"100003171", "orgId":"development", "orgName":"研发部", "ownerName":"apollo", "ownerEmail":"[email protected]", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2019-05-08T09:13:31.000+0800", "dataChangeLastModifiedTime":"2019-05-08T09:13:31.000+0800" }, { "name":"apollo-demo", "appId":"100004458", "orgId":"development", "orgName":"产品研发部", "ownerName":"apollo", "ownerEmail":"[email protected]", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2019-04-08T13:58:36.000+0800" } ] ``` ##### 3.2.3 获取集群接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} * **Method** : GET * **Request Params** :无 * **返回值Sample**: ``` json { "name":"default", "appId":"100004458", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2018-12-23T12:35:16.000+0800" } ``` ##### 3.2.4 创建集群接口 可以通过此接口创建集群,调用此接口需要授予第三方APP对目标APP的管理权限。 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- name | true | String | Cluster的名字 appId | true | String | Cluster所属的AppId dataChangeCreatedBy | true | String | namespace的创建人,格式为域账号,也就是sso系统的User ID * **返回值 Sample** : ``` json { "name":"someClusterName", "appId":"100004458", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2018-12-23T12:35:16.000+0800" } ``` ##### 3.2.5 获取集群下所有Namespace信息接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces * **Method**: GET * **Request Params**: 无 * **返回值Sample**: ``` json [ { "appId": "100003171", "clusterName": "default", "namespaceName": "application", "comment": "default app namespace", "format": "properties", //Namespace格式可能取值为:properties、xml、json、yml、yaml "isPublic": false, //是否为公共的Namespace "items": [ // Namespace下所有的配置集合 { "key": "batch", "value": "100", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-21T16:03:43.000+0800", "dataChangeLastModifiedTime": "2016-07-21T16:03:43.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:05:58.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:05:58.000+0800" }, { "appId": "100003171", "clusterName": "default", "namespaceName": "FX.apollo", "comment": "apollo public namespace", "format": "properties", "isPublic": true, "items": [ { "key": "request.timeout", "value": "3000", "comment": "", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:08:30.000+0800", "dataChangeLastModifiedTime": "2016-08-01T13:56:25.000+0800" }, { "id": 1116, "key": "batch", "value": "3000", "comment": "", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-28T15:13:42.000+0800", "dataChangeLastModifiedTime": "2016-08-01T13:51:00.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:08:13.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:08:13.000+0800" } ] ``` ##### 3.2.6 获取某个Namespace信息接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName} * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "appId": "100003171", "clusterName": "default", "namespaceName": "application", "comment": "default app namespace", "format": "properties", //Namespace格式可能取值为:properties、xml、json、yml、yaml "isPublic": false, //是否为公共的Namespace "items": [ // Namespace下所有的配置集合 { "key": "batch", "value": "100", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-21T16:03:43.000+0800", "dataChangeLastModifiedTime": "2016-07-21T16:03:43.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:05:58.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:05:58.000+0800" } ``` ##### 3.2.7 创建Namespace 可以通过此接口创建Namespace,调用此接口需要授予第三方APP对目标APP的管理权限。 * **URL** : http://{portal_address}/openapi/v1/apps/{appId}/appnamespaces * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- name | true | String | Namespace的名字 appId | true | String | Namespace所属的AppId format |true | String | Namespace的格式,**只能是以下类型: properties、xml、json、yml、yaml** isPublic |true | boolean | 是否是公共文件 comment |false | String | Namespace说明 dataChangeCreatedBy | true | String | namespace的创建人,格式为域账号,也就是sso系统的User ID * **返回值 Sample** : ``` json { "name": "FX.public-0420-11", "appId": "100003173", "format": "properties", "isPublic": true, "comment": "test", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2017-04-20T18:25:49.033+0800", "dataChangeLastModifiedTime": "2017-04-20T18:25:49.033+0800" } ``` * **返回值说明** : > 如果是properties文件,name = ${appId所属的部门}.${传入的name值} ,例如调用接口传入的name=xy-z, format=properties,应用的部门为框架(FX),那么name=FX.xy-z > 如果不是properties文件 name = ${appId所属的部门}.${传入的name值}.${format},例如调用接口传入的name=xy-z, format=json,应用的部门为框架(FX),那么name=FX.xy-z.json ##### 3.2.8 获取某个Namespace当前编辑人接口 Apollo在生产环境(PRO)有限制规则:每次发布只能有一个人编辑配置,且该次发布的人不能是该次发布的编辑人。 也就是说如果一个用户A修改了某个namespace的配置,那么在这个namespace发布前,只能由A修改,其它用户无法修改。同时,该用户A无法发布自己修改的配置,必须找另一个有发布权限的人操作。 这个接口就是用来获取当前namespace是否有人锁定的接口。在非生产环境(FAT、UAT),该接口始终返回没有人锁定。 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock * **Method** : GET * **Request Params** :无 * **返回值 Sample(未锁定)** : ``` json { "namespaceName": "application", "isLocked": false } ``` * **返回值Sample(被锁定)** : ``` json { "namespaceName": "application", "isLocked": true, "lockedBy": "song_s" //锁owner } ``` ##### 3.2.9 读取配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key} * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "key": "timeout", "value": "3000", "comment": "超时时间", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T12:06:41.818+0800", "dataChangeLastModifiedTime": "2016-08-11T12:06:41.818+0800" } ``` ##### 3.2.10 新增配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- key | true | String | 配置的key,长度不能超过128个字符。非properties格式,key固定为`content` value | true | String | 配置的value,长度不能超过20000个字符,非properties格式,value为文件全部内容 comment | false | String | 配置的备注,长度不能超过1024个字符 dataChangeCreatedBy | true | String | item的创建人,格式为域账号,也就是sso系统的User ID * **Request body sample** : ``` json { "key":"timeout", "value":"3000", "comment":"超时时间", "dataChangeCreatedBy":"zhanglea" } ``` * **返回值Sample** : ``` json { "key": "timeout", "value": "3000", "comment": "超时时间", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T12:06:41.818+0800", "dataChangeLastModifiedTime": "2016-08-11T12:06:41.818+0800" } ``` ##### 3.2.11 修改配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key} * **Method** : PUT * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- createIfNotExists | false | Boolean | 当配置不存在时是否自动创建 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- key | true | String | 配置的key,需和url中的key值一致。非properties格式,key固定为`content` value | true | String | 配置的value,长度不能超过20000个字符,非properties格式,value为文件全部内容 comment | false | String | 配置的备注,长度不能超过1024个字符 dataChangeLastModifiedBy | true | String | item的修改人,格式为域账号,也就是sso系统的User ID dataChangeCreatedBy | false | String | 当createIfNotExists为true时必选。item的创建人,格式为域账号,也就是sso系统的User ID * **Request body sample** : ```json { "key":"timeout", "value":"3000", "comment":"超时时间", "dataChangeLastModifiedBy":"zhanglea" } ``` * **返回值** :无 ##### 3.2.12 删除配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key}?operator={operator} * **Method** : DELETE * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- key | true | String | 配置的key。非properties格式,key固定为`content` operator | true | String | 删除配置的操作者,域账号 * **返回值** : 无 ##### 3.2.13 发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases * **Method** : POST * **Request Params** :无 * **Request Body** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- releaseTitle | true | String | 此次发布的标题,长度不能超过64个字符 releaseComment | false | String | 发布的备注,长度不能超过256个字符 releasedBy | true | String | 发布人,域账号,注意:如果`ApolloConfigDB.ServerConfig`中的`namespace.lock.switch`设置为true的话(默认是false),那么该环境不允许发布人和编辑人为同一人。所以如果编辑人是zhanglea,发布人就不能再是zhanglea。 * **Request Body example** : ```json { "releaseTitle":"2016-08-11", "releaseComment":"修改timeout值", "releasedBy":"zhanglea" } ``` * **返回值Sample** : ``` json { "appId": "test-0620-01", "clusterName": "test", "namespaceName": "application", "name": "2016-08-11", "configurations": { "timeout": "3000", }, "comment": "修改timeout值", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T14:03:46.232+0800", "dataChangeLastModifiedTime": "2016-08-11T14:03:46.235+0800" } ``` ##### 3.2.14 获取某个Namespace当前生效的已发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "appId": "test-0620-01", "clusterName": "test", "namespaceName": "application", "name": "2016-08-11", "configurations": { "timeout": "3000", }, "comment": "修改timeout值", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T14:03:46.232+0800", "dataChangeLastModifiedTime": "2016-08-11T14:03:46.235+0800" } ``` ##### 3.2.15 回滚已发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/releases/{releaseId}/rollback * **Method** : PUT * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- operator | true | String | 删除配置的操作者,域账号 * **返回值** : 无 ### 四、错误码说明 正常情况下,接口返回的Http状态码是200,下面列举了Apollo会返回的非200错误码说明。 #### 4.1 400 - Bad Request 客户端传入参数的错误,如操作人不存在,namespace不存在等等,客户端需要根据提示信息检查对应的参数是否正确。 #### 4.2 401 - Unauthorized 接口传入的token非法或者已过期,客户端需要检查token是否传入正确。 #### 4.3 403 - Forbidden 接口要访问的资源未得到授权,比如只授权了对A应用下Namespace的管理权限,但是却尝试管理B应用下的配置。 #### 4.4 404 - Not Found 接口要访问的资源不存在,一般是URL或URL的参数错误。 #### 4.5 405 - Method Not Allowed 接口访问的Method不正确,比如应该使用POST的接口使用了GET访问等,客户端需要检查接口访问方式是否正确。 #### 4.6 500 - Internal Server Error 其它类型的错误默认都会返回500,对这类错误如果应用无法根据提示信息找到原因的话,可以找Apollo研发团队一起排查问题。
### 一、 什么是开放平台? Apollo提供了一套的Http REST接口,使第三方应用能够自己管理配置。虽然Apollo系统本身提供了Portal来管理配置,但是在有些情景下,应用需要通过程序去管理配置。 ### 二、 第三方应用接入Apollo开放平台 #### 2.1 注册第三方应用 第三方应用负责人需要向Apollo管理员提供一些第三方应用基本信息。 基本信息如下: * 第三方应用的AppId、应用名、部门 * 第三方应用负责人 Apollo管理员在 http://{portal_address}/open/manage.html 创建第三方应用,创建之前最好先查询此AppId是否已经创建。创建成功之后会生成一个token,如下图所示: ![开放平台管理](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/apollo-open-manage.png) #### 2.2 给已注册的第三方应用授权 第三方应用不应该能操作任何Namespace的配置,所以需要给token绑定可以操作的Namespace。Apollo管理员在 http://{portal_address}/open/manage.html 页面给token赋权。赋权之后,第三方应用就可以通过Apollo提供的Http REST接口来管理已授权的Namespace的配置了。 #### 2.3 第三方应用调用Apollo Open API ##### 2.3.1 调用Http REST接口 任何语言的第三方应用都可以调用Apollo的Open API,在调用接口时,需要设置注意以下两点: * Http Header中增加一个Authorization字段,字段值为申请的token * Http Header的Content-Type字段需要设置成application/json;charset=UTF-8 ##### 2.3.2 Java应用通过apollo-openapi调用Apollo Open API 从1.1.0版本开始,Apollo提供了[apollo-openapi](https://github.com/ctripcorp/apollo/tree/master/apollo-openapi)客户端,所以Java语言的第三方应用可以更方便地调用Apollo Open API。 首先引入`apollo-openapi`依赖: ```xml <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-openapi</artifactId> <version>1.7.0</version> </dependency> ``` 在程序中构造`ApolloOpenApiClient`: ```java String portalUrl = "http://localhost:8070"; // portal url String token = "e16e5cd903fd0c97a116c873b448544b9d086de9"; // 申请的token ApolloOpenApiClient client = ApolloOpenApiClient.newBuilder() .withPortalUrl(portalUrl) .withToken(token) .build(); ``` 后续就可以通过`ApolloOpenApiClient`的接口直接操作Apollo Open API了,接口说明参见下面的Rest接口文档。 ##### 2.3.3 .Net core应用调用Apollo Open API .Net core也提供了open api的客户端,详见https://github.com/ctripcorp/apollo.net/pull/77 ### 三、 接口文档 #### 3.1 URL路径参数说明 参数名 | 参数说明 --- | --- env | 所管理的配置环境 appId | 所管理的配置AppId clusterName | 所管理的配置集群名, 一般情况下传入 default 即可。如果是特殊集群,传入相应集群的名称即可 namespaceName | 所管理的Namespace的名称,如果是非properties格式,需要加上后缀名,如`sample.yml` #### 3.2 API接口列表 ##### 3.2.1 获取App的环境,集群信息 * **URL** : http://{portal_address}/openapi/v1/apps/{appId}/envclusters * **Method** : GET * **Request Params** : 无 * **返回值Sample**: ``` json [ { "env":"FAT", "clusters":[ //集群列表 "default", "FAT381" ] }, { "env":"UAT", "clusters":[ "default" ] }, { "env":"PRO", "clusters":[ "default", "SHAOY", "SHAJQ" ] } ] ``` ##### 3.2.2 获取App信息 * **URL** : http://{portal_address}/openapi/v1/apps * **Method** : GET * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- appIds | false | String | appId列表,以逗号分隔,如果为空则返回所有App信息 * **返回值Sample**: ``` json [ { "name":"first_app", "appId":"100003171", "orgId":"development", "orgName":"研发部", "ownerName":"apollo", "ownerEmail":"[email protected]", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2019-05-08T09:13:31.000+0800", "dataChangeLastModifiedTime":"2019-05-08T09:13:31.000+0800" }, { "name":"apollo-demo", "appId":"100004458", "orgId":"development", "orgName":"产品研发部", "ownerName":"apollo", "ownerEmail":"[email protected]", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2019-04-08T13:58:36.000+0800" } ] ``` ##### 3.2.3 获取集群接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} * **Method** : GET * **Request Params** :无 * **返回值Sample**: ``` json { "name":"default", "appId":"100004458", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2018-12-23T12:35:16.000+0800" } ``` ##### 3.2.4 创建集群接口 可以通过此接口创建集群,调用此接口需要授予第三方APP对目标APP的管理权限。 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- name | true | String | Cluster的名字 appId | true | String | Cluster所属的AppId dataChangeCreatedBy | true | String | namespace的创建人,格式为域账号,也就是sso系统的User ID * **返回值 Sample** : ``` json { "name":"someClusterName", "appId":"100004458", "dataChangeCreatedBy":"apollo", "dataChangeLastModifiedBy":"apollo", "dataChangeCreatedTime":"2018-12-23T12:35:16.000+0800", "dataChangeLastModifiedTime":"2018-12-23T12:35:16.000+0800" } ``` ##### 3.2.5 获取集群下所有Namespace信息接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces * **Method**: GET * **Request Params**: 无 * **返回值Sample**: ``` json [ { "appId": "100003171", "clusterName": "default", "namespaceName": "application", "comment": "default app namespace", "format": "properties", //Namespace格式可能取值为:properties、xml、json、yml、yaml "isPublic": false, //是否为公共的Namespace "items": [ // Namespace下所有的配置集合 { "key": "batch", "value": "100", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-21T16:03:43.000+0800", "dataChangeLastModifiedTime": "2016-07-21T16:03:43.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:05:58.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:05:58.000+0800" }, { "appId": "100003171", "clusterName": "default", "namespaceName": "FX.apollo", "comment": "apollo public namespace", "format": "properties", "isPublic": true, "items": [ { "key": "request.timeout", "value": "3000", "comment": "", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:08:30.000+0800", "dataChangeLastModifiedTime": "2016-08-01T13:56:25.000+0800" }, { "id": 1116, "key": "batch", "value": "3000", "comment": "", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-28T15:13:42.000+0800", "dataChangeLastModifiedTime": "2016-08-01T13:51:00.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:08:13.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:08:13.000+0800" } ] ``` ##### 3.2.6 获取某个Namespace信息接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName} * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "appId": "100003171", "clusterName": "default", "namespaceName": "application", "comment": "default app namespace", "format": "properties", //Namespace格式可能取值为:properties、xml、json、yml、yaml "isPublic": false, //是否为公共的Namespace "items": [ // Namespace下所有的配置集合 { "key": "batch", "value": "100", "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-21T16:03:43.000+0800", "dataChangeLastModifiedTime": "2016-07-21T16:03:43.000+0800" } ], "dataChangeCreatedBy": "song_s", "dataChangeLastModifiedBy": "song_s", "dataChangeCreatedTime": "2016-07-20T14:05:58.000+0800", "dataChangeLastModifiedTime": "2016-07-20T14:05:58.000+0800" } ``` ##### 3.2.7 创建Namespace 可以通过此接口创建Namespace,调用此接口需要授予第三方APP对目标APP的管理权限。 * **URL** : http://{portal_address}/openapi/v1/apps/{appId}/appnamespaces * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- name | true | String | Namespace的名字 appId | true | String | Namespace所属的AppId format |true | String | Namespace的格式,**只能是以下类型: properties、xml、json、yml、yaml** isPublic |true | boolean | 是否是公共文件 comment |false | String | Namespace说明 dataChangeCreatedBy | true | String | namespace的创建人,格式为域账号,也就是sso系统的User ID * **返回值 Sample** : ``` json { "name": "FX.public-0420-11", "appId": "100003173", "format": "properties", "isPublic": true, "comment": "test", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2017-04-20T18:25:49.033+0800", "dataChangeLastModifiedTime": "2017-04-20T18:25:49.033+0800" } ``` * **返回值说明** : > 如果是properties文件,name = ${appId所属的部门}.${传入的name值} ,例如调用接口传入的name=xy-z, format=properties,应用的部门为框架(FX),那么name=FX.xy-z > 如果不是properties文件 name = ${appId所属的部门}.${传入的name值}.${format},例如调用接口传入的name=xy-z, format=json,应用的部门为框架(FX),那么name=FX.xy-z.json ##### 3.2.8 获取某个Namespace当前编辑人接口 Apollo在生产环境(PRO)有限制规则:每次发布只能有一个人编辑配置,且该次发布的人不能是该次发布的编辑人。 也就是说如果一个用户A修改了某个namespace的配置,那么在这个namespace发布前,只能由A修改,其它用户无法修改。同时,该用户A无法发布自己修改的配置,必须找另一个有发布权限的人操作。 这个接口就是用来获取当前namespace是否有人锁定的接口。在非生产环境(FAT、UAT),该接口始终返回没有人锁定。 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock * **Method** : GET * **Request Params** :无 * **返回值 Sample(未锁定)** : ``` json { "namespaceName": "application", "isLocked": false } ``` * **返回值Sample(被锁定)** : ``` json { "namespaceName": "application", "isLocked": true, "lockedBy": "song_s" //锁owner } ``` ##### 3.2.9 读取配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key} * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "key": "timeout", "value": "3000", "comment": "超时时间", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T12:06:41.818+0800", "dataChangeLastModifiedTime": "2016-08-11T12:06:41.818+0800" } ``` ##### 3.2.10 新增配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items * **Method** : POST * **Request Params** :无 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- key | true | String | 配置的key,长度不能超过128个字符。非properties格式,key固定为`content` value | true | String | 配置的value,长度不能超过20000个字符,非properties格式,value为文件全部内容 comment | false | String | 配置的备注,长度不能超过1024个字符 dataChangeCreatedBy | true | String | item的创建人,格式为域账号,也就是sso系统的User ID * **Request body sample** : ``` json { "key":"timeout", "value":"3000", "comment":"超时时间", "dataChangeCreatedBy":"zhanglea" } ``` * **返回值Sample** : ``` json { "key": "timeout", "value": "3000", "comment": "超时时间", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T12:06:41.818+0800", "dataChangeLastModifiedTime": "2016-08-11T12:06:41.818+0800" } ``` ##### 3.2.11 修改配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key} * **Method** : PUT * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- createIfNotExists | false | Boolean | 当配置不存在时是否自动创建 * **请求内容(Request Body, JSON格式)** : 参数名 | 必选 | 类型 | 说明 ---- | --- | --- | --- key | true | String | 配置的key,需和url中的key值一致。非properties格式,key固定为`content` value | true | String | 配置的value,长度不能超过20000个字符,非properties格式,value为文件全部内容 comment | false | String | 配置的备注,长度不能超过1024个字符 dataChangeLastModifiedBy | true | String | item的修改人,格式为域账号,也就是sso系统的User ID dataChangeCreatedBy | false | String | 当createIfNotExists为true时必选。item的创建人,格式为域账号,也就是sso系统的User ID * **Request body sample** : ```json { "key":"timeout", "value":"3000", "comment":"超时时间", "dataChangeLastModifiedBy":"zhanglea" } ``` * **返回值** :无 ##### 3.2.12 删除配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key}?operator={operator} * **Method** : DELETE * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- key | true | String | 配置的key。非properties格式,key固定为`content` operator | true | String | 删除配置的操作者,域账号 * **返回值** : 无 ##### 3.2.13 发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases * **Method** : POST * **Request Params** :无 * **Request Body** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- releaseTitle | true | String | 此次发布的标题,长度不能超过64个字符 releaseComment | false | String | 发布的备注,长度不能超过256个字符 releasedBy | true | String | 发布人,域账号,注意:如果`ApolloConfigDB.ServerConfig`中的`namespace.lock.switch`设置为true的话(默认是false),那么该环境不允许发布人和编辑人为同一人。所以如果编辑人是zhanglea,发布人就不能再是zhanglea。 * **Request Body example** : ```json { "releaseTitle":"2016-08-11", "releaseComment":"修改timeout值", "releasedBy":"zhanglea" } ``` * **返回值Sample** : ``` json { "appId": "test-0620-01", "clusterName": "test", "namespaceName": "application", "name": "2016-08-11", "configurations": { "timeout": "3000", }, "comment": "修改timeout值", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T14:03:46.232+0800", "dataChangeLastModifiedTime": "2016-08-11T14:03:46.235+0800" } ``` ##### 3.2.14 获取某个Namespace当前生效的已发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest * **Method** : GET * **Request Params** :无 * **返回值Sample** : ``` json { "appId": "test-0620-01", "clusterName": "test", "namespaceName": "application", "name": "2016-08-11", "configurations": { "timeout": "3000", }, "comment": "修改timeout值", "dataChangeCreatedBy": "zhanglea", "dataChangeLastModifiedBy": "zhanglea", "dataChangeCreatedTime": "2016-08-11T14:03:46.232+0800", "dataChangeLastModifiedTime": "2016-08-11T14:03:46.235+0800" } ``` ##### 3.2.15 回滚已发布配置接口 * **URL** : http://{portal_address}/openapi/v1/envs/{env}/releases/{releaseId}/rollback * **Method** : PUT * **Request Params** : 参数名 | 必选 | 类型 | 说明 --- | --- | --- | --- operator | true | String | 删除配置的操作者,域账号 * **返回值** : 无 ### 四、错误码说明 正常情况下,接口返回的Http状态码是200,下面列举了Apollo会返回的非200错误码说明。 #### 4.1 400 - Bad Request 客户端传入参数的错误,如操作人不存在,namespace不存在等等,客户端需要根据提示信息检查对应的参数是否正确。 #### 4.2 401 - Unauthorized 接口传入的token非法或者已过期,客户端需要检查token是否传入正确。 #### 4.3 403 - Forbidden 接口要访问的资源未得到授权,比如只授权了对A应用下Namespace的管理权限,但是却尝试管理B应用下的配置。 #### 4.4 404 - Not Found 接口要访问的资源不存在,一般是URL或URL的参数错误。 #### 4.5 405 - Method Not Allowed 接口访问的Method不正确,比如应该使用POST的接口使用了GET访问等,客户端需要检查接口访问方式是否正确。 #### 4.6 500 - Internal Server Error 其它类型的错误默认都会返回500,对这类错误如果应用无法根据提示信息找到原因的话,可以找Apollo研发团队一起排查问题。
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/WebContextConfiguration.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.ctrip; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter; import com.google.common.base.Strings; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration @Profile("ctrip") public class WebContextConfiguration { private final PortalConfig portalConfig; private final UserInfoHolder userInfoHolder; public WebContextConfiguration(final PortalConfig portalConfig, final UserInfoHolder userInfoHolder) { this.portalConfig = portalConfig; this.userInfoHolder = userInfoHolder; } @Bean public ServletContextInitializer servletContextInitializer() { return servletContext -> { String loggingServerIP = portalConfig.cloggingUrl(); String loggingServerPort = portalConfig.cloggingPort(); String credisServiceUrl = portalConfig.credisServiceUrl(); servletContext.setInitParameter("loggingServerIP", Strings.isNullOrEmpty(loggingServerIP) ? "" : loggingServerIP); servletContext.setInitParameter("loggingServerPort", Strings.isNullOrEmpty(loggingServerPort) ? "" : loggingServerPort); servletContext.setInitParameter("credisServiceUrl", Strings.isNullOrEmpty(credisServiceUrl) ? "" : credisServiceUrl); }; } @Bean public FilterRegistrationBean userAccessFilter() { FilterRegistrationBean filter = new FilterRegistrationBean(); filter.setFilter(new UserAccessFilter(userInfoHolder)); filter.addUrlPatterns("/*"); return filter; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.ctrip; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter; import com.google.common.base.Strings; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration @Profile("ctrip") public class WebContextConfiguration { private final PortalConfig portalConfig; private final UserInfoHolder userInfoHolder; public WebContextConfiguration(final PortalConfig portalConfig, final UserInfoHolder userInfoHolder) { this.portalConfig = portalConfig; this.userInfoHolder = userInfoHolder; } @Bean public ServletContextInitializer servletContextInitializer() { return servletContext -> { String loggingServerIP = portalConfig.cloggingUrl(); String loggingServerPort = portalConfig.cloggingPort(); String credisServiceUrl = portalConfig.credisServiceUrl(); servletContext.setInitParameter("loggingServerIP", Strings.isNullOrEmpty(loggingServerIP) ? "" : loggingServerIP); servletContext.setInitParameter("loggingServerPort", Strings.isNullOrEmpty(loggingServerPort) ? "" : loggingServerPort); servletContext.setInitParameter("credisServiceUrl", Strings.isNullOrEmpty(credisServiceUrl) ? "" : credisServiceUrl); }; } @Bean public FilterRegistrationBean userAccessFilter() { FilterRegistrationBean filter = new FilterRegistrationBean(); filter.setFilter(new UserAccessFilter(userInfoHolder)); filter.addUrlPatterns("/*"); return filter; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/http/RichResponseEntity.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.common.http; import org.springframework.http.HttpStatus; public class RichResponseEntity<T>{ private int code; private Object message; private T body; public static <T> RichResponseEntity<T> ok(T body){ RichResponseEntity<T> richResponseEntity = new RichResponseEntity<>(); richResponseEntity.message = HttpStatus.OK.getReasonPhrase(); richResponseEntity.code = HttpStatus.OK.value(); richResponseEntity.body = body; return richResponseEntity; } public static <T> RichResponseEntity<T> error(HttpStatus httpCode, Object message){ RichResponseEntity<T> richResponseEntity = new RichResponseEntity<>(); richResponseEntity.message = message; richResponseEntity.code = httpCode.value(); return richResponseEntity; } public int getCode() { return code; } public Object getMessage() { return message; } public T getBody() { return body; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.common.http; import org.springframework.http.HttpStatus; public class RichResponseEntity<T>{ private int code; private Object message; private T body; public static <T> RichResponseEntity<T> ok(T body){ RichResponseEntity<T> richResponseEntity = new RichResponseEntity<>(); richResponseEntity.message = HttpStatus.OK.getReasonPhrase(); richResponseEntity.code = HttpStatus.OK.value(); richResponseEntity.body = body; return richResponseEntity; } public static <T> RichResponseEntity<T> error(HttpStatus httpCode, Object message){ RichResponseEntity<T> richResponseEntity = new RichResponseEntity<>(); richResponseEntity.message = message; richResponseEntity.code = httpCode.value(); return richResponseEntity; } public int getCode() { return code; } public Object getMessage() { return message; } public T getBody() { return body; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/community/thank-you.md
# 致谢 <hr /> <img src="en/images/community/jetbrains.svg" alt="jetbrains" style="height: 80px; margin-right: 20px"> <img src="en/images/community/intellij-idea.svg" alt="intellij-idea" style="width: 75px" > Apollo 团队使用 [IntelliJ IDEA](https://www.jetbrains.com/idea/) 开发开源项目,非常感谢 [JetBrains](https://www.jetbrains.com/) 赞助许可证。 <hr /> <img src="en/images/community/docsify.svg" alt="docsify" style="height: 80px"> Apollo 团队使用 [docsify](https://docsify.js.org/) 生成文档站点。
# 致谢 <hr /> <img src="en/images/community/jetbrains.svg" alt="jetbrains" style="height: 80px; margin-right: 20px"> <img src="en/images/community/intellij-idea.svg" alt="intellij-idea" style="width: 75px" > Apollo 团队使用 [IntelliJ IDEA](https://www.jetbrains.com/idea/) 开发开源项目,非常感谢 [JetBrains](https://www.jetbrains.com/) 赞助许可证。 <hr /> <img src="en/images/community/docsify.svg" alt="docsify" style="height: 80px"> Apollo 团队使用 [docsify](https://docsify.js.org/) 生成文档站点。
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseHistoryService.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.constants.GsonType; import com.ctrip.framework.apollo.common.dto.PageDTO; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO; import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI.ReleaseHistoryAPI; import com.ctrip.framework.apollo.portal.enricher.adapter.BaseDtoUserInfoEnrichedAdapter; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.util.RelativeDateFormat; import com.google.gson.Gson; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.util.CollectionUtils; @Service public class ReleaseHistoryService { private final static Gson GSON = new Gson(); private final AdminServiceAPI.ReleaseHistoryAPI releaseHistoryAPI; private final ReleaseService releaseService; private final AdditionalUserInfoEnrichService additionalUserInfoEnrichService; public ReleaseHistoryService(final ReleaseHistoryAPI releaseHistoryAPI, final ReleaseService releaseService, AdditionalUserInfoEnrichService additionalUserInfoEnrichService) { this.releaseHistoryAPI = releaseHistoryAPI; this.releaseService = releaseService; this.additionalUserInfoEnrichService = additionalUserInfoEnrichService; } public ReleaseHistoryBO findLatestByReleaseIdAndOperation(Env env, long releaseId, int operation){ PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByReleaseIdAndOperation(env, releaseId, operation, 0, 1); if (pageDTO != null && pageDTO.hasContent()){ ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0); ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return transformReleaseHistoryDTO2BO(releaseHistory, release); } return null; } public ReleaseHistoryBO findLatestByPreviousReleaseIdAndOperation(Env env, long previousReleaseId, int operation){ PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByPreviousReleaseIdAndOperation(env, previousReleaseId, operation, 0, 1); if (pageDTO != null && pageDTO.hasContent()){ ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0); ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return transformReleaseHistoryDTO2BO(releaseHistory, release); } return null; } public List<ReleaseHistoryBO> findNamespaceReleaseHistory(String appId, Env env, String clusterName, String namespaceName, int page, int size) { PageDTO<ReleaseHistoryDTO> result = releaseHistoryAPI.findReleaseHistoriesByNamespace(appId, env, clusterName, namespaceName, page, size); if (result == null || !result.hasContent()) { return Collections.emptyList(); } List<ReleaseHistoryDTO> content = result.getContent(); Set<Long> releaseIds = new HashSet<>(); for (ReleaseHistoryDTO releaseHistoryDTO : content) { long releaseId = releaseHistoryDTO.getReleaseId(); if (releaseId != 0) { releaseIds.add(releaseId); } } List<ReleaseDTO> releases = releaseService.findReleaseByIds(env, releaseIds); return transformReleaseHistoryDTO2BO(content, releases); } private List<ReleaseHistoryBO> transformReleaseHistoryDTO2BO(List<ReleaseHistoryDTO> source, List<ReleaseDTO> releases) { if (CollectionUtils.isEmpty(source)) { return Collections.emptyList(); } this.additionalUserInfoEnrichService.enrichAdditionalUserInfo(source, BaseDtoUserInfoEnrichedAdapter::new); Map<Long, ReleaseDTO> releasesMap = BeanUtils.mapByKey("id", releases); List<ReleaseHistoryBO> bos = new ArrayList<>(source.size()); for (ReleaseHistoryDTO dto : source) { ReleaseDTO release = releasesMap.get(dto.getReleaseId()); bos.add(transformReleaseHistoryDTO2BO(dto, release)); } return bos; } private ReleaseHistoryBO transformReleaseHistoryDTO2BO(ReleaseHistoryDTO dto, ReleaseDTO release){ ReleaseHistoryBO bo = new ReleaseHistoryBO(); bo.setId(dto.getId()); bo.setAppId(dto.getAppId()); bo.setClusterName(dto.getClusterName()); bo.setNamespaceName(dto.getNamespaceName()); bo.setBranchName(dto.getBranchName()); bo.setReleaseId(dto.getReleaseId()); bo.setPreviousReleaseId(dto.getPreviousReleaseId()); bo.setOperator(dto.getDataChangeCreatedBy()); bo.setOperatorDisplayName(dto.getDataChangeCreatedByDisplayName()); bo.setOperation(dto.getOperation()); Date releaseTime = dto.getDataChangeLastModifiedTime(); bo.setReleaseTime(releaseTime); bo.setReleaseTimeFormatted(RelativeDateFormat.format(releaseTime)); bo.setOperationContext(dto.getOperationContext()); //set release info setReleaseInfoToReleaseHistoryBO(bo, release); return bo; } private void setReleaseInfoToReleaseHistoryBO(ReleaseHistoryBO bo, ReleaseDTO release) { if (release != null) { bo.setReleaseTitle(release.getName()); bo.setReleaseComment(release.getComment()); bo.setReleaseAbandoned(release.isAbandoned()); Map<String, String> configuration = GSON.fromJson(release.getConfigurations(), GsonType.CONFIG); List<EntityPair<String>> items = new ArrayList<>(configuration.size()); for (Map.Entry<String, String> entry : configuration.entrySet()) { EntityPair<String> entityPair = new EntityPair<>(entry.getKey(), entry.getValue()); items.add(entityPair); } bo.setConfiguration(items); } else { bo.setReleaseTitle("no release information"); bo.setConfiguration(null); } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.constants.GsonType; import com.ctrip.framework.apollo.common.dto.PageDTO; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.dto.ReleaseHistoryDTO; import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI.ReleaseHistoryAPI; import com.ctrip.framework.apollo.portal.enricher.adapter.BaseDtoUserInfoEnrichedAdapter; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.util.RelativeDateFormat; import com.google.gson.Gson; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.util.CollectionUtils; @Service public class ReleaseHistoryService { private final static Gson GSON = new Gson(); private final AdminServiceAPI.ReleaseHistoryAPI releaseHistoryAPI; private final ReleaseService releaseService; private final AdditionalUserInfoEnrichService additionalUserInfoEnrichService; public ReleaseHistoryService(final ReleaseHistoryAPI releaseHistoryAPI, final ReleaseService releaseService, AdditionalUserInfoEnrichService additionalUserInfoEnrichService) { this.releaseHistoryAPI = releaseHistoryAPI; this.releaseService = releaseService; this.additionalUserInfoEnrichService = additionalUserInfoEnrichService; } public ReleaseHistoryBO findLatestByReleaseIdAndOperation(Env env, long releaseId, int operation){ PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByReleaseIdAndOperation(env, releaseId, operation, 0, 1); if (pageDTO != null && pageDTO.hasContent()){ ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0); ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return transformReleaseHistoryDTO2BO(releaseHistory, release); } return null; } public ReleaseHistoryBO findLatestByPreviousReleaseIdAndOperation(Env env, long previousReleaseId, int operation){ PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByPreviousReleaseIdAndOperation(env, previousReleaseId, operation, 0, 1); if (pageDTO != null && pageDTO.hasContent()){ ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0); ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return transformReleaseHistoryDTO2BO(releaseHistory, release); } return null; } public List<ReleaseHistoryBO> findNamespaceReleaseHistory(String appId, Env env, String clusterName, String namespaceName, int page, int size) { PageDTO<ReleaseHistoryDTO> result = releaseHistoryAPI.findReleaseHistoriesByNamespace(appId, env, clusterName, namespaceName, page, size); if (result == null || !result.hasContent()) { return Collections.emptyList(); } List<ReleaseHistoryDTO> content = result.getContent(); Set<Long> releaseIds = new HashSet<>(); for (ReleaseHistoryDTO releaseHistoryDTO : content) { long releaseId = releaseHistoryDTO.getReleaseId(); if (releaseId != 0) { releaseIds.add(releaseId); } } List<ReleaseDTO> releases = releaseService.findReleaseByIds(env, releaseIds); return transformReleaseHistoryDTO2BO(content, releases); } private List<ReleaseHistoryBO> transformReleaseHistoryDTO2BO(List<ReleaseHistoryDTO> source, List<ReleaseDTO> releases) { if (CollectionUtils.isEmpty(source)) { return Collections.emptyList(); } this.additionalUserInfoEnrichService.enrichAdditionalUserInfo(source, BaseDtoUserInfoEnrichedAdapter::new); Map<Long, ReleaseDTO> releasesMap = BeanUtils.mapByKey("id", releases); List<ReleaseHistoryBO> bos = new ArrayList<>(source.size()); for (ReleaseHistoryDTO dto : source) { ReleaseDTO release = releasesMap.get(dto.getReleaseId()); bos.add(transformReleaseHistoryDTO2BO(dto, release)); } return bos; } private ReleaseHistoryBO transformReleaseHistoryDTO2BO(ReleaseHistoryDTO dto, ReleaseDTO release){ ReleaseHistoryBO bo = new ReleaseHistoryBO(); bo.setId(dto.getId()); bo.setAppId(dto.getAppId()); bo.setClusterName(dto.getClusterName()); bo.setNamespaceName(dto.getNamespaceName()); bo.setBranchName(dto.getBranchName()); bo.setReleaseId(dto.getReleaseId()); bo.setPreviousReleaseId(dto.getPreviousReleaseId()); bo.setOperator(dto.getDataChangeCreatedBy()); bo.setOperatorDisplayName(dto.getDataChangeCreatedByDisplayName()); bo.setOperation(dto.getOperation()); Date releaseTime = dto.getDataChangeLastModifiedTime(); bo.setReleaseTime(releaseTime); bo.setReleaseTimeFormatted(RelativeDateFormat.format(releaseTime)); bo.setOperationContext(dto.getOperationContext()); //set release info setReleaseInfoToReleaseHistoryBO(bo, release); return bo; } private void setReleaseInfoToReleaseHistoryBO(ReleaseHistoryBO bo, ReleaseDTO release) { if (release != null) { bo.setReleaseTitle(release.getName()); bo.setReleaseComment(release.getComment()); bo.setReleaseAbandoned(release.isAbandoned()); Map<String, String> configuration = GSON.fromJson(release.getConfigurations(), GsonType.CONFIG); List<EntityPair<String>> items = new ArrayList<>(configuration.size()); for (Map.Entry<String, String> entry : configuration.entrySet()) { EntityPair<String> entityPair = new EntityPair<>(entry.getKey(), entry.getValue()); items.add(entityPair); } bo.setConfiguration(items); } else { bo.setReleaseTitle("no release information"); bo.setConfiguration(null); } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/EmailConfiguration.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile; import com.ctrip.framework.apollo.portal.spi.EmailService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripEmailService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripEmailRequestBuilder; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultEmailService; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration public class EmailConfiguration { /** * spring.profiles.active = ctrip */ @Configuration @Profile("ctrip") public static class CtripEmailConfiguration { @Bean public EmailService ctripEmailService() { return new CtripEmailService(); } @Bean public CtripEmailRequestBuilder emailRequestBuilder() { return new CtripEmailRequestBuilder(); } } /** * spring.profiles.active != ctrip */ @Configuration @ConditionalOnMissingProfile({"ctrip"}) public static class DefaultEmailConfiguration { @Bean @ConditionalOnMissingBean(EmailService.class) public EmailService defaultEmailService() { return new DefaultEmailService(); } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile; import com.ctrip.framework.apollo.portal.spi.EmailService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripEmailService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripEmailRequestBuilder; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultEmailService; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration public class EmailConfiguration { /** * spring.profiles.active = ctrip */ @Configuration @Profile("ctrip") public static class CtripEmailConfiguration { @Bean public EmailService ctripEmailService() { return new CtripEmailService(); } @Bean public CtripEmailRequestBuilder emailRequestBuilder() { return new CtripEmailRequestBuilder(); } } /** * spring.profiles.active != ctrip */ @Configuration @ConditionalOnMissingProfile({"ctrip"}) public static class DefaultEmailConfiguration { @Bean @ConditionalOnMissingBean(EmailService.class) public EmailService defaultEmailService() { return new DefaultEmailService(); } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ClusterControllerTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.controller; import com.ctrip.framework.apollo.biz.entity.Cluster; import com.ctrip.framework.apollo.biz.service.ClusterService; import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.utils.InputValidator; import com.ctrip.framework.apollo.core.ConfigConsts; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; import static org.hamcrest.Matchers.containsString; import static org.mockito.Mockito.*; public class ClusterControllerTest extends AbstractControllerTest { private ClusterController clusterController; @Mock private ClusterService clusterService; @Before public void setUp() { MockitoAnnotations.initMocks(this); clusterController = new ClusterController(clusterService); } @Test(expected = BadRequestException.class) public void testDeleteDefaultFail() { Cluster cluster = new Cluster(); cluster.setName(ConfigConsts.CLUSTER_NAME_DEFAULT); when(clusterService.findOne(any(String.class), any(String.class))).thenReturn(cluster); clusterController.delete("1", "2", "d"); } @Test public void testDeleteSuccess() { Cluster cluster = new Cluster(); when(clusterService.findOne(any(String.class), any(String.class))).thenReturn(cluster); clusterController.delete("1", "2", "d"); verify(clusterService, times(1)).findOne("1", "2"); } @Test public void shouldFailWhenRequestBodyInvalid() { ClusterDTO cluster = new ClusterDTO(); cluster.setAppId("valid"); cluster.setName("notBlank"); ResponseEntity<ClusterDTO> response = restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId()); ClusterDTO createdCluster = response.getBody(); Assert.assertNotNull(createdCluster); Assert.assertEquals(cluster.getAppId(), createdCluster.getAppId()); Assert.assertEquals(cluster.getName(), createdCluster.getName()); cluster.setName("invalid app name"); try { restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId()); Assert.fail("Should throw"); } catch (HttpClientErrorException e) { Assert.assertThat(new String(e.getResponseBodyAsByteArray()), containsString(InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE)); } } private String baseUrl() { return "http://localhost:" + port; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.controller; import com.ctrip.framework.apollo.biz.entity.Cluster; import com.ctrip.framework.apollo.biz.service.ClusterService; import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.utils.InputValidator; import com.ctrip.framework.apollo.core.ConfigConsts; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; import static org.hamcrest.Matchers.containsString; import static org.mockito.Mockito.*; public class ClusterControllerTest extends AbstractControllerTest { private ClusterController clusterController; @Mock private ClusterService clusterService; @Before public void setUp() { MockitoAnnotations.initMocks(this); clusterController = new ClusterController(clusterService); } @Test(expected = BadRequestException.class) public void testDeleteDefaultFail() { Cluster cluster = new Cluster(); cluster.setName(ConfigConsts.CLUSTER_NAME_DEFAULT); when(clusterService.findOne(any(String.class), any(String.class))).thenReturn(cluster); clusterController.delete("1", "2", "d"); } @Test public void testDeleteSuccess() { Cluster cluster = new Cluster(); when(clusterService.findOne(any(String.class), any(String.class))).thenReturn(cluster); clusterController.delete("1", "2", "d"); verify(clusterService, times(1)).findOne("1", "2"); } @Test public void shouldFailWhenRequestBodyInvalid() { ClusterDTO cluster = new ClusterDTO(); cluster.setAppId("valid"); cluster.setName("notBlank"); ResponseEntity<ClusterDTO> response = restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId()); ClusterDTO createdCluster = response.getBody(); Assert.assertNotNull(createdCluster); Assert.assertEquals(cluster.getAppId(), createdCluster.getAppId()); Assert.assertEquals(cluster.getName(), createdCluster.getName()); cluster.setName("invalid app name"); try { restTemplate.postForEntity(baseUrl() + "/apps/{appId}/clusters", cluster, ClusterDTO.class, cluster.getAppId()); Assert.fail("Should throw"); } catch (HttpClientErrorException e) { Assert.assertThat(new String(e.getResponseBodyAsByteArray()), containsString(InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE)); } } private String baseUrl() { return "http://localhost:" + port; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/filter/ClientAuthenticationFilter.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.filter; import com.ctrip.framework.apollo.configservice.util.AccessKeyUtil; import com.ctrip.framework.apollo.core.signature.Signature; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.google.common.net.HttpHeaders; import java.io.IOException; import java.util.List; import java.util.Objects; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; /** * @author nisiyong */ public class ClientAuthenticationFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(ClientAuthenticationFilter.class); private static final Long TIMESTAMP_INTERVAL = 60 * 1000L; private final AccessKeyUtil accessKeyUtil; public ClientAuthenticationFilter(AccessKeyUtil accessKeyUtil) { this.accessKeyUtil = accessKeyUtil; } @Override public void init(FilterConfig filterConfig) throws ServletException { //nothing } @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; String appId = accessKeyUtil.extractAppIdFromRequest(request); if (StringUtils.isBlank(appId)) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "InvalidAppId"); return; } List<String> availableSecrets = accessKeyUtil.findAvailableSecret(appId); if (!CollectionUtils.isEmpty(availableSecrets)) { String timestamp = request.getHeader(Signature.HTTP_HEADER_TIMESTAMP); String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); // check timestamp, valid within 1 minute if (!checkTimestamp(timestamp)) { logger.warn("Invalid timestamp. appId={},timestamp={}", appId, timestamp); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "RequestTimeTooSkewed"); return; } // check signature String uri = request.getRequestURI(); String query = request.getQueryString(); if (!checkAuthorization(authorization, availableSecrets, timestamp, uri, query)) { logger.warn("Invalid authorization. appId={},authorization={}", appId, authorization); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); return; } } chain.doFilter(request, response); } @Override public void destroy() { //nothing } private boolean checkTimestamp(String timestamp) { long requestTimeMillis = 0L; try { requestTimeMillis = Long.parseLong(timestamp); } catch (NumberFormatException e) { // nothing to do } long x = System.currentTimeMillis() - requestTimeMillis; return x >= -TIMESTAMP_INTERVAL && x <= TIMESTAMP_INTERVAL; } private boolean checkAuthorization(String authorization, List<String> availableSecrets, String timestamp, String path, String query) { String signature = null; if (authorization != null) { String[] split = authorization.split(":"); if (split.length > 1) { signature = split[1]; } } for (String secret : availableSecrets) { String availableSignature = accessKeyUtil.buildSignature(path, query, timestamp, secret); if (Objects.equals(signature, availableSignature)) { return true; } } return false; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.filter; import com.ctrip.framework.apollo.configservice.util.AccessKeyUtil; import com.ctrip.framework.apollo.core.signature.Signature; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.google.common.net.HttpHeaders; import java.io.IOException; import java.util.List; import java.util.Objects; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; /** * @author nisiyong */ public class ClientAuthenticationFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(ClientAuthenticationFilter.class); private static final Long TIMESTAMP_INTERVAL = 60 * 1000L; private final AccessKeyUtil accessKeyUtil; public ClientAuthenticationFilter(AccessKeyUtil accessKeyUtil) { this.accessKeyUtil = accessKeyUtil; } @Override public void init(FilterConfig filterConfig) throws ServletException { //nothing } @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; String appId = accessKeyUtil.extractAppIdFromRequest(request); if (StringUtils.isBlank(appId)) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "InvalidAppId"); return; } List<String> availableSecrets = accessKeyUtil.findAvailableSecret(appId); if (!CollectionUtils.isEmpty(availableSecrets)) { String timestamp = request.getHeader(Signature.HTTP_HEADER_TIMESTAMP); String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); // check timestamp, valid within 1 minute if (!checkTimestamp(timestamp)) { logger.warn("Invalid timestamp. appId={},timestamp={}", appId, timestamp); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "RequestTimeTooSkewed"); return; } // check signature String uri = request.getRequestURI(); String query = request.getQueryString(); if (!checkAuthorization(authorization, availableSecrets, timestamp, uri, query)) { logger.warn("Invalid authorization. appId={},authorization={}", appId, authorization); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized"); return; } } chain.doFilter(request, response); } @Override public void destroy() { //nothing } private boolean checkTimestamp(String timestamp) { long requestTimeMillis = 0L; try { requestTimeMillis = Long.parseLong(timestamp); } catch (NumberFormatException e) { // nothing to do } long x = System.currentTimeMillis() - requestTimeMillis; return x >= -TIMESTAMP_INTERVAL && x <= TIMESTAMP_INTERVAL; } private boolean checkAuthorization(String authorization, List<String> availableSecrets, String timestamp, String path, String query) { String signature = null; if (authorization != null) { String[] split = authorization.split(":"); if (split.length > 1) { signature = split[1]; } } for (String secret : availableSecrets) { String availableSignature = accessKeyUtil.buildSignature(path, query, timestamp, secret); if (Objects.equals(signature, availableSignature)) { return true; } } return false; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/AccessKeyServiceWithCache.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.service; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.AccessKey; import com.ctrip.framework.apollo.biz.repository.AccessKeyRepository; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.tracer.spi.Transaction; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.MultimapBuilder.ListMultimapBuilder; import com.google.common.collect.Multimaps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; /** * @author nisiyong */ @Service public class AccessKeyServiceWithCache implements InitializingBean { private static Logger logger = LoggerFactory.getLogger(AccessKeyServiceWithCache.class); private final AccessKeyRepository accessKeyRepository; private final BizConfig bizConfig; private int scanInterval; private TimeUnit scanIntervalTimeUnit; private int rebuildInterval; private TimeUnit rebuildIntervalTimeUnit; private ScheduledExecutorService scheduledExecutorService; private Date lastTimeScanned; private ListMultimap<String, AccessKey> accessKeyCache; private ConcurrentMap<Long, AccessKey> accessKeyIdCache; @Autowired public AccessKeyServiceWithCache(AccessKeyRepository accessKeyRepository, BizConfig bizConfig) { this.accessKeyRepository = accessKeyRepository; this.bizConfig = bizConfig; initialize(); } private void initialize() { scheduledExecutorService = new ScheduledThreadPoolExecutor(1, ApolloThreadFactory.create("AccessKeyServiceWithCache", true)); lastTimeScanned = new Date(0L); ListMultimap<String, AccessKey> multimap = ListMultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER) .arrayListValues().build(); accessKeyCache = Multimaps.synchronizedListMultimap(multimap); accessKeyIdCache = Maps.newConcurrentMap(); } public List<String> getAvailableSecrets(String appId) { List<AccessKey> accessKeys = accessKeyCache.get(appId); if (CollectionUtils.isEmpty(accessKeys)) { return Collections.emptyList(); } return accessKeys.stream() .filter(AccessKey::isEnabled) .map(AccessKey::getSecret) .collect(Collectors.toList()); } @Override public void afterPropertiesSet() throws Exception { populateDataBaseInterval(); scanNewAndUpdatedAccessKeys(); //block the startup process until load finished scheduledExecutorService.scheduleWithFixedDelay(this::scanNewAndUpdatedAccessKeys, scanInterval, scanInterval, scanIntervalTimeUnit); scheduledExecutorService.scheduleAtFixedRate(this::rebuildAccessKeyCache, rebuildInterval, rebuildInterval, rebuildIntervalTimeUnit); } private void scanNewAndUpdatedAccessKeys() { Transaction transaction = Tracer.newTransaction("Apollo.AccessKeyServiceWithCache", "scanNewAndUpdatedAccessKeys"); try { loadNewAndUpdatedAccessKeys(); transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { transaction.setStatus(ex); logger.error("Load new/updated app access keys failed", ex); } finally { transaction.complete(); } } private void rebuildAccessKeyCache() { Transaction transaction = Tracer.newTransaction("Apollo.AccessKeyServiceWithCache", "rebuildCache"); try { deleteAccessKeyCache(); transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { transaction.setStatus(ex); logger.error("Rebuild cache failed", ex); } finally { transaction.complete(); } } private void loadNewAndUpdatedAccessKeys() { boolean hasMore = true; while (hasMore && !Thread.currentThread().isInterrupted()) { //current batch is 500 List<AccessKey> accessKeys = accessKeyRepository .findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(lastTimeScanned); if (CollectionUtils.isEmpty(accessKeys)) { break; } int scanned = accessKeys.size(); mergeAccessKeys(accessKeys); logger.info("Loaded {} new/updated Accesskey from startTime {}", scanned, lastTimeScanned); hasMore = scanned == 500; lastTimeScanned = accessKeys.get(scanned - 1).getDataChangeLastModifiedTime(); // In order to avoid missing some records at the last time, we need to scan records at this time individually if (hasMore) { List<AccessKey> lastModifiedTimeAccessKeys = accessKeyRepository.findByDataChangeLastModifiedTime(lastTimeScanned); mergeAccessKeys(lastModifiedTimeAccessKeys); logger.info("Loaded {} new/updated Accesskey at lastModifiedTime {}", scanned, lastTimeScanned); } } } private void mergeAccessKeys(List<AccessKey> accessKeys) { for (AccessKey accessKey : accessKeys) { AccessKey thatInCache = accessKeyIdCache.get(accessKey.getId()); accessKeyIdCache.put(accessKey.getId(), accessKey); accessKeyCache.put(accessKey.getAppId(), accessKey); if (thatInCache != null && accessKey.getDataChangeLastModifiedTime() .after(thatInCache.getDataChangeLastModifiedTime())) { accessKeyCache.remove(accessKey.getAppId(), thatInCache); logger.info("Found Accesskey changes, old: {}, new: {}", thatInCache, accessKey); } } } private void deleteAccessKeyCache() { List<Long> ids = Lists.newArrayList(accessKeyIdCache.keySet()); if (CollectionUtils.isEmpty(ids)) { return; } List<List<Long>> partitionIds = Lists.partition(ids, 500); for (List<Long> toRebuildIds : partitionIds) { Iterable<AccessKey> accessKeys = accessKeyRepository.findAllById(toRebuildIds); Set<Long> foundIds = Sets.newHashSet(); for (AccessKey accessKey : accessKeys) { foundIds.add(accessKey.getId()); } //handle deleted SetView<Long> deletedIds = Sets.difference(Sets.newHashSet(toRebuildIds), foundIds); handleDeletedAccessKeys(deletedIds); } } private void handleDeletedAccessKeys(Set<Long> deletedIds) { if (CollectionUtils.isEmpty(deletedIds)) { return; } for (Long deletedId : deletedIds) { AccessKey deleted = accessKeyIdCache.remove(deletedId); if (deleted == null) { continue; } accessKeyCache.remove(deleted.getAppId(), deleted); logger.info("Found AccessKey deleted, {}", deleted); } } private void populateDataBaseInterval() { scanInterval = bizConfig.accessKeyCacheScanInterval(); scanIntervalTimeUnit = bizConfig.accessKeyCacheScanIntervalTimeUnit(); rebuildInterval = bizConfig.accessKeyCacheRebuildInterval(); rebuildIntervalTimeUnit = bizConfig.accessKeyCacheRebuildIntervalTimeUnit(); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.service; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.AccessKey; import com.ctrip.framework.apollo.biz.repository.AccessKeyRepository; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.tracer.spi.Transaction; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.MultimapBuilder.ListMultimapBuilder; import com.google.common.collect.Multimaps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; /** * @author nisiyong */ @Service public class AccessKeyServiceWithCache implements InitializingBean { private static Logger logger = LoggerFactory.getLogger(AccessKeyServiceWithCache.class); private final AccessKeyRepository accessKeyRepository; private final BizConfig bizConfig; private int scanInterval; private TimeUnit scanIntervalTimeUnit; private int rebuildInterval; private TimeUnit rebuildIntervalTimeUnit; private ScheduledExecutorService scheduledExecutorService; private Date lastTimeScanned; private ListMultimap<String, AccessKey> accessKeyCache; private ConcurrentMap<Long, AccessKey> accessKeyIdCache; @Autowired public AccessKeyServiceWithCache(AccessKeyRepository accessKeyRepository, BizConfig bizConfig) { this.accessKeyRepository = accessKeyRepository; this.bizConfig = bizConfig; initialize(); } private void initialize() { scheduledExecutorService = new ScheduledThreadPoolExecutor(1, ApolloThreadFactory.create("AccessKeyServiceWithCache", true)); lastTimeScanned = new Date(0L); ListMultimap<String, AccessKey> multimap = ListMultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER) .arrayListValues().build(); accessKeyCache = Multimaps.synchronizedListMultimap(multimap); accessKeyIdCache = Maps.newConcurrentMap(); } public List<String> getAvailableSecrets(String appId) { List<AccessKey> accessKeys = accessKeyCache.get(appId); if (CollectionUtils.isEmpty(accessKeys)) { return Collections.emptyList(); } return accessKeys.stream() .filter(AccessKey::isEnabled) .map(AccessKey::getSecret) .collect(Collectors.toList()); } @Override public void afterPropertiesSet() throws Exception { populateDataBaseInterval(); scanNewAndUpdatedAccessKeys(); //block the startup process until load finished scheduledExecutorService.scheduleWithFixedDelay(this::scanNewAndUpdatedAccessKeys, scanInterval, scanInterval, scanIntervalTimeUnit); scheduledExecutorService.scheduleAtFixedRate(this::rebuildAccessKeyCache, rebuildInterval, rebuildInterval, rebuildIntervalTimeUnit); } private void scanNewAndUpdatedAccessKeys() { Transaction transaction = Tracer.newTransaction("Apollo.AccessKeyServiceWithCache", "scanNewAndUpdatedAccessKeys"); try { loadNewAndUpdatedAccessKeys(); transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { transaction.setStatus(ex); logger.error("Load new/updated app access keys failed", ex); } finally { transaction.complete(); } } private void rebuildAccessKeyCache() { Transaction transaction = Tracer.newTransaction("Apollo.AccessKeyServiceWithCache", "rebuildCache"); try { deleteAccessKeyCache(); transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { transaction.setStatus(ex); logger.error("Rebuild cache failed", ex); } finally { transaction.complete(); } } private void loadNewAndUpdatedAccessKeys() { boolean hasMore = true; while (hasMore && !Thread.currentThread().isInterrupted()) { //current batch is 500 List<AccessKey> accessKeys = accessKeyRepository .findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(lastTimeScanned); if (CollectionUtils.isEmpty(accessKeys)) { break; } int scanned = accessKeys.size(); mergeAccessKeys(accessKeys); logger.info("Loaded {} new/updated Accesskey from startTime {}", scanned, lastTimeScanned); hasMore = scanned == 500; lastTimeScanned = accessKeys.get(scanned - 1).getDataChangeLastModifiedTime(); // In order to avoid missing some records at the last time, we need to scan records at this time individually if (hasMore) { List<AccessKey> lastModifiedTimeAccessKeys = accessKeyRepository.findByDataChangeLastModifiedTime(lastTimeScanned); mergeAccessKeys(lastModifiedTimeAccessKeys); logger.info("Loaded {} new/updated Accesskey at lastModifiedTime {}", scanned, lastTimeScanned); } } } private void mergeAccessKeys(List<AccessKey> accessKeys) { for (AccessKey accessKey : accessKeys) { AccessKey thatInCache = accessKeyIdCache.get(accessKey.getId()); accessKeyIdCache.put(accessKey.getId(), accessKey); accessKeyCache.put(accessKey.getAppId(), accessKey); if (thatInCache != null && accessKey.getDataChangeLastModifiedTime() .after(thatInCache.getDataChangeLastModifiedTime())) { accessKeyCache.remove(accessKey.getAppId(), thatInCache); logger.info("Found Accesskey changes, old: {}, new: {}", thatInCache, accessKey); } } } private void deleteAccessKeyCache() { List<Long> ids = Lists.newArrayList(accessKeyIdCache.keySet()); if (CollectionUtils.isEmpty(ids)) { return; } List<List<Long>> partitionIds = Lists.partition(ids, 500); for (List<Long> toRebuildIds : partitionIds) { Iterable<AccessKey> accessKeys = accessKeyRepository.findAllById(toRebuildIds); Set<Long> foundIds = Sets.newHashSet(); for (AccessKey accessKey : accessKeys) { foundIds.add(accessKey.getId()); } //handle deleted SetView<Long> deletedIds = Sets.difference(Sets.newHashSet(toRebuildIds), foundIds); handleDeletedAccessKeys(deletedIds); } } private void handleDeletedAccessKeys(Set<Long> deletedIds) { if (CollectionUtils.isEmpty(deletedIds)) { return; } for (Long deletedId : deletedIds) { AccessKey deleted = accessKeyIdCache.remove(deletedId); if (deleted == null) { continue; } accessKeyCache.remove(deleted.getAppId(), deleted); logger.info("Found AccessKey deleted, {}", deleted); } } private void populateDataBaseInterval() { scanInterval = bizConfig.accessKeyCacheScanInterval(); scanIntervalTimeUnit = bizConfig.accessKeyCacheScanIntervalTimeUnit(); rebuildInterval = bizConfig.accessKeyCacheRebuildInterval(); rebuildIntervalTimeUnit = bizConfig.accessKeyCacheRebuildIntervalTimeUnit(); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/community/team.md
# Apollo 团队 Apollo 团队由 Member 和 Contributor 组成。Member 可以直接访问 Apollo 项目的源代码并基于代码库积极演进。Contributor 通过向 Member 提交补丁和建议来改善项目,项目的贡献者数量是没有限制的。无论是进行小规模的清理,提交新的功能或其它形式的贡献,都将受到极大的赞赏。 有关社区治理模型的更多信息,请参考[GOVERNANCE.md](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md)。 ## Member Member 包括 PMC 成员和 Committer,该列表按字母顺序排列。 ### Project Management Committee(PMC) | Github ID | Name | Organization | | ---------- | ---------- | ------------ | | JaredTan95 | Jared Tan | DaoCloud | | kezhenxu94 | Zhenxu Ke | Tetrate | | nobodyiam | Jason Song | Ant Group | | zouyx | Joe Zou | Shein | ### Committer | Github ID | Name | Organization | | ----------- | ------------- | ------------ | | Anilople | Xiaoquan Wang | Some Bank | | klboke | Kailing Chen | TapTap | | lepdou | Le Zhang | Ant Group | | nisiyong | Stephen Ni | Qihoo 360 | | pengweiqhca | Wei Peng | Tuhu | | vdisk-group | Lvqiu Ye | Hundsun | ## Contributor ### Apollo 主仓库 <a href="https://github.com/ctripcorp/apollo/graphs/contributors"><img src="https://opencollective.com/apollo/contributors.svg?width=880&button=false" /></a> ### apollo.net <a href="https://github.com/ctripcorp/apollo.net/graphs/contributors"><img src="https://opencollective.com/apollonet/contributors.svg?width=880&button=false" /></a> ## **如何成为提交者** 请参考 [How to become a Committer](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md#how-to-become-a-committer).
# Apollo 团队 Apollo 团队由 Member 和 Contributor 组成。Member 可以直接访问 Apollo 项目的源代码并基于代码库积极演进。Contributor 通过向 Member 提交补丁和建议来改善项目,项目的贡献者数量是没有限制的。无论是进行小规模的清理,提交新的功能或其它形式的贡献,都将受到极大的赞赏。 有关社区治理模型的更多信息,请参考[GOVERNANCE.md](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md)。 ## Member Member 包括 PMC 成员和 Committer,该列表按字母顺序排列。 ### Project Management Committee(PMC) | Github ID | Name | Organization | | ---------- | ---------- | ------------ | | JaredTan95 | Jared Tan | DaoCloud | | kezhenxu94 | Zhenxu Ke | Tetrate | | nobodyiam | Jason Song | Ant Group | | zouyx | Joe Zou | Shein | ### Committer | Github ID | Name | Organization | | ----------- | ------------- | ------------ | | Anilople | Xiaoquan Wang | Some Bank | | klboke | Kailing Chen | TapTap | | lepdou | Le Zhang | Ant Group | | nisiyong | Stephen Ni | Qihoo 360 | | pengweiqhca | Wei Peng | Tuhu | | vdisk-group | Lvqiu Ye | Hundsun | ## Contributor ### Apollo 主仓库 <a href="https://github.com/ctripcorp/apollo/graphs/contributors"><img src="https://opencollective.com/apollo/contributors.svg?width=880&button=false" /></a> ### apollo.net <a href="https://github.com/ctripcorp/apollo.net/graphs/contributors"><img src="https://opencollective.com/apollonet/contributors.svg?width=880&button=false" /></a> ## **如何成为提交者** 请参考 [How to become a Committer](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md#how-to-become-a-committer).
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/development/portal-how-to-implement-user-login-function.md
Apollo是配置管理系统,会提供权限管理(Authorization),理论上是不负责用户登录认证功能的实现(Authentication)。 所以Apollo定义了一些SPI用来解耦,Apollo接入登录的关键就是实现这些SPI。 ## 实现方式一:使用Apollo提供的Spring Security简单认证 可能很多公司并没有统一的登录认证系统,如果自己实现一套会比较麻烦。Apollo针对这种情况,从0.9.0开始提供了利用Spring Security实现的Http Basic简单认证版本。 使用步骤如下: ### 1. 安装0.9.0以上版本 >如果之前是0.8.0版本,需要导入[apolloportaldb-v080-v090.sql](https://github.com/ctripcorp/apollo/blob/master/scripts/sql/delta/v080-v090/apolloportaldb-v080-v090.sql) 查看ApolloPortalDB,应该已经存在`Users`表,并有一条初始记录。初始用户名是apollo,密码是admin。 |Id|Username|Password|Email|Enabled| |-|-|-|-|-| |1|apollo|$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS|[email protected]|1| ### 2. 重启Portal 如果是IDE启动的话,确保`-Dapollo_profile=github,auth` ### 3. 添加用户 超级管理员登录系统后打开`管理员工具 - 用户管理`即可添加用户。 ### 4. 修改用户密码 超级管理员登录系统后打开`管理员工具 - 用户管理`,输入用户名和密码后即可修改用户密码,建议同时修改超级管理员apollo的密码。 ## 实现方式二: 接入LDAP 从1.2.0版本开始,Apollo支持了ldap协议的登录,按照如下方式配置即可。 > 如果采用helm chart部署方式,建议通过配置方式实现,不用修改镜像,可以参考[启用 LDAP 支持](zh/deployment/distributed-deployment-guide#_241449-启用-ldap-支持) ### 1. OpenLDAP接入方式 #### 1.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-openldap-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 ``` ##### 1.1.1 基于memberOf过滤用户 OpenLDAP[开启memberOf特性](https://myanbin.github.io/post/enable-memberof-in-openldap.html)后,可以配置filter从而缩小用户搜索的范围: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 filter: # 配置过滤,目前只支持 memberOf memberOf: "cn=ServiceDEV,ou=DEV,dc=example,dc=org|cn=WebDEV,ou=DEV,dc=example,dc=org" # 只允许 memberOf 属性为 ServiceDEV 和 WebDEV 的用户访问 ``` ##### 1.1.2 基于Group过滤用户 从1.3.0版本开始支持基于Group过滤用户,从而可以控制只有特定Group的用户可以登录和使用apollo: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "uid" # ldap rdn key userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 group: # 启用group search,启用后只有特定group的用户可以登录apollo objectClass: "posixGroup" # 配置groupClassName groupBase: "ou=group" # group search base groupSearch: "(&(cn=dev))" # group filter groupMembership: "memberUid" # group memberShip eg. member or memberUid ``` #### 1.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ### 2. Active Directory接入方式 #### 2.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-activedirectory-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=com" username: "admin" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(sAMAccountName={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://1.1.1.1:389" ldap: mapping: # 配置 ldap 属性 objectClass: "user" # ldap 用户 objectClass 配置 loginId: "sAMAccountName" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "userPrincipalName" # ldap 邮箱属性 filter: # 可选项,配置过滤,目前只支持 memberOf memberOf: "CN=ServiceDEV,OU=test,DC=example,DC=com|CN=WebDEV,OU=test,DC=example,DC=com" # 只允许 memberOf 属性为 ServiceDEV 和 WebDEV 的用户访问 ``` #### 2.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ### 3. ApacheDS接入方式 #### 3.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-apacheds-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 ``` ##### 3.1.1 基于Group过滤用户 从1.3.0版本开始支持基于Group过滤用户,从而可以控制只有特定Group的用户可以登录和使用apollo: ```yml spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "cn" # ldap rdn key userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 group: # 配置ldap group,启用后只有特定group的用户可以登录apollo objectClass: "groupOfNames" # 配置groupClassName groupBase: "ou=group" # group search base groupSearch: "(&(cn=dev))" # group filter groupMembership: "member" # group memberShip eg. member or memberUid ``` #### 3.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ## 实现方式三: 接入OIDC 从 1.8.0 版本开始支持 OpenID Connect 登录, 这种实现方式的前提是已经部署了 OpenID Connect 登录服务 配置前需要准备: * OpenID Connect 的提供者配置端点(符合 RFC 8414 标准的 issuer-uri), 需要是 **https** 的, 例如 https://host:port/auth/realms/apollo/.well-known/openid-configuration * 在 OpenID Connect 服务里创建一个 client, idToken 的签名算法必须设置为 **RS256**, 获取 client-id 以及对应的 client-secret ### 1. 配置 `application-oidc.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-oidc.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-oidc-sample.yml)),相关的内容需要按照具体情况调整: #### 1.1 最小配置 ```yml spring: security: oauth2: client: provider: # provider-name 是 oidc 提供者的名称, 任意字符均可, registration 的配置需要用到这个名称 provider-name: # 必须是 https, oidc 的 issuer-uri # 例如 你的 issuer-uri 是 https://host:port/auth/realms/apollo/.well-known/openid-configuration, 那么此处只需要配置 https://host:port/auth/realms/apollo 即可, spring boot 处理的时候会加上 /.well-known/openid-configuration 的后缀 issuer-uri: https://host:port/auth/realms/apollo registration: # registration-name 是 oidc 客户端的名称, 任意字符均可, oidc 登录必须配置一个 authorization_code 类型的 registration registration-name: # oidc 登录必须配置一个 authorization_code 类型的 registration authorization-grant-type: authorization_code client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider # 从安全角度考虑更推荐使用环境变量来配置, 环境变量的命名规则为: 将配置项的 key 当中的 点(.)、横杠(-)替换为下划线(_), 然后将所有字母改为大写, spring boot 会自动处理符合此规则的环境变量 # 例如 spring.security.oauth2.client.registration.registration-name.client-secret -> SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_NAME_VDISK_CLIENT_SECRET (REGISTRATION_NAME 可以替换为自定义的 oidc 客户端的名称) client-secret: d43c91c0-xxxx-xxxx-xxxx-xxxxxxxxxxxx ``` #### 1.2 扩展配置 * 如果 OpenID Connect 登录服务支持 client_credentials 模式, 还可以再配置一个 client_credentials 类型的 registration, 用于 apollo-portal 作为客户端请求其它被 oidc 保护的资源 * 如果 OpenID Connect 登录服务支持 jwt, 还可以配置 ${spring.security.oauth2.resourceserver.jwt.issuer-uri}, 以支持通过 jwt 访问 apollo-portal ```yml spring: security: oauth2: client: provider: # provider-name 是 oidc 提供者的名称, 任意字符均可, registration 的配置需要用到这个名称 provider-name: # 必须是 https, oidc 的 issuer-uri, 和 jwt 的 issuer-uri 一致的话直接引用即可, 也可以单独设置 issuer-uri: ${spring.security.oauth2.resourceserver.jwt.issuer-uri} registration: # registration-name 是 oidc 客户端的名称, 任意字符均可, oidc 登录必须配置一个 authorization_code 类型的 registration registration-name: # oidc 登录必须配置一个 authorization_code 类型的 registration authorization-grant-type: authorization_code client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider # 从安全角度考虑更推荐使用环境变量来配置, 环境变量的命名规则为: 将配置项的 key 当中的 点(.)、横杠(-)替换为下划线(_), 然后将所有字母改为大写, spring boot 会自动处理符合此规则的环境变量 # 例如 spring.security.oauth2.client.registration.registration-name.client-secret -> SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_NAME_VDISK_CLIENT_SECRET (REGISTRATION_NAME 可以替换为自定义的 oidc 客户端的名称) client-secret: d43c91c0-xxxx-xxxx-xxxx-xxxxxxxxxxxx # registration-name-client 是 oidc 客户端的名称, 任意字符均可, client_credentials 类型的 registration 为选填项, 可以不配置 registration-name-client: # client_credentials 类型的 registration 为选填项, 用于 apollo-portal 作为客户端请求其它被 oidc 保护的资源, 可以不配置 authorization-grant-type: client_credentials client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider, 多个 registration 的密码如果一致可以直接引用 client-secret: ${spring.security.oauth2.client.registration.registration-name.client-secret} resourceserver: jwt: # 必须是 https, jwt 的 issuer-uri # 例如 你的 issuer-uri 是 https://host:port/auth/realms/apollo/.well-known/openid-configuration, 那么此处只需要配置 https://host:port/auth/realms/apollo 即可, spring boot 处理的时候会自动加上 /.well-known/openid-configuration 的后缀 issuer-uri: https://host:port/auth/realms/apollo ``` ### 2. 配置 `startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,oidc`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,oidc" ``` ## 实现方式四: 接入公司的统一登录认证系统 这种实现方式的前提是公司已经有统一的登录认证系统,最常见的比如SSO、LDAP等。接入时,实现以下SPI。其中UserService和UserInfoHolder是必须要实现的。 接口说明如下: * UserService(Required):用户服务,用来给Portal提供用户搜索相关功能 * UserInfoHolder(Required):获取当前登录用户信息,SSO一般都是把当前登录用户信息放在线程ThreadLocal上 * LogoutHandler(Optional):用来实现登出功能 * SsoHeartbeatHandler(Optional):Portal页面如果长时间不刷新,登录信息会过期。通过此接口来刷新登录信息 可以参考apollo-portal下的[com.ctrip.framework.apollo.portal.spi](https://github.com/ctripcorp/apollo/tree/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi)这个包下面的四个实现: 1. defaultimpl:默认实现,全局只有apollo一个账号 2. ctrip:ctrip实现,接入了SSO并实现用户搜索、查询接口 3. springsecurity: spring security实现,可以新增用户,修改用户密码等 4. ldap: [@pandalin](https://github.com/pandalin)和[codepiano](https://github.com/codepiano)贡献的ldap实现 实现了相关接口后,可以通过[com.ctrip.framework.apollo.portal.configuration.AuthConfiguration](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java)在运行时替换默认的实现。 接入SSO的思路如下: 1. SSO会提供一个jar包,需要配置一个filter 2. filter会拦截所有请求,检查是否已经登录 3. 如果没有登录,那么就会跳转到SSO的登录页面 4. 在SSO登录页面登录成功后,会跳转回apollo的页面,带上认证的信息 5. 再次进入SSO的filter,校验认证信息,把用户的信息保存下来,并且把用户凭证写入cookie或分布式session,以免下次还要重新登录 6. 进入Apollo的代码,Apollo的代码会调用UserInfoHolder.getUser获取当前登录用户 注意,以上1-5这几步都是SSO的代码,不是Apollo的代码,Apollo的代码只需要你实现第6步。 >注:运行时使用不同的实现是通过[Profiles](http://docs.spring.io/autorepo/docs/spring-boot/current/reference/html/boot-features-profiles.html)实现的,比如你自己的sso实现是在`custom` profile中的话,在打包脚本中可以指定-Dapollo_profile=github,custom。其中`github`是Apollo必须的一个profile,用于数据库的配置,`custom`是你自己实现的profile。同时需要注意在[AuthConfiguration](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java)中修改默认实现的条件 ,从`@ConditionalOnMissingProfile({"ctrip", "auth", "ldap"})`改为`@ConditionalOnMissingProfile({"ctrip", "auth", "ldap", "custom"})`。
Apollo是配置管理系统,会提供权限管理(Authorization),理论上是不负责用户登录认证功能的实现(Authentication)。 所以Apollo定义了一些SPI用来解耦,Apollo接入登录的关键就是实现这些SPI。 ## 实现方式一:使用Apollo提供的Spring Security简单认证 可能很多公司并没有统一的登录认证系统,如果自己实现一套会比较麻烦。Apollo针对这种情况,从0.9.0开始提供了利用Spring Security实现的Http Basic简单认证版本。 使用步骤如下: ### 1. 安装0.9.0以上版本 >如果之前是0.8.0版本,需要导入[apolloportaldb-v080-v090.sql](https://github.com/ctripcorp/apollo/blob/master/scripts/sql/delta/v080-v090/apolloportaldb-v080-v090.sql) 查看ApolloPortalDB,应该已经存在`Users`表,并有一条初始记录。初始用户名是apollo,密码是admin。 |Id|Username|Password|Email|Enabled| |-|-|-|-|-| |1|apollo|$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS|[email protected]|1| ### 2. 重启Portal 如果是IDE启动的话,确保`-Dapollo_profile=github,auth` ### 3. 添加用户 超级管理员登录系统后打开`管理员工具 - 用户管理`即可添加用户。 ### 4. 修改用户密码 超级管理员登录系统后打开`管理员工具 - 用户管理`,输入用户名和密码后即可修改用户密码,建议同时修改超级管理员apollo的密码。 ## 实现方式二: 接入LDAP 从1.2.0版本开始,Apollo支持了ldap协议的登录,按照如下方式配置即可。 > 如果采用helm chart部署方式,建议通过配置方式实现,不用修改镜像,可以参考[启用 LDAP 支持](zh/deployment/distributed-deployment-guide#_241449-启用-ldap-支持) ### 1. OpenLDAP接入方式 #### 1.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-openldap-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 ``` ##### 1.1.1 基于memberOf过滤用户 OpenLDAP[开启memberOf特性](https://myanbin.github.io/post/enable-memberof-in-openldap.html)后,可以配置filter从而缩小用户搜索的范围: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 filter: # 配置过滤,目前只支持 memberOf memberOf: "cn=ServiceDEV,ou=DEV,dc=example,dc=org|cn=WebDEV,ou=DEV,dc=example,dc=org" # 只允许 memberOf 属性为 ServiceDEV 和 WebDEV 的用户访问 ``` ##### 1.1.2 基于Group过滤用户 从1.3.0版本开始支持基于Group过滤用户,从而可以控制只有特定Group的用户可以登录和使用apollo: ```yml spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "uid" # ldap rdn key userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 group: # 启用group search,启用后只有特定group的用户可以登录apollo objectClass: "posixGroup" # 配置groupClassName groupBase: "ou=group" # group search base groupSearch: "(&(cn=dev))" # group filter groupMembership: "memberUid" # group memberShip eg. member or memberUid ``` #### 1.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ### 2. Active Directory接入方式 #### 2.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-activedirectory-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=com" username: "admin" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(sAMAccountName={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://1.1.1.1:389" ldap: mapping: # 配置 ldap 属性 objectClass: "user" # ldap 用户 objectClass 配置 loginId: "sAMAccountName" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "cn" # ldap 用户名,用来作为显示名 email: "userPrincipalName" # ldap 邮箱属性 filter: # 可选项,配置过滤,目前只支持 memberOf memberOf: "CN=ServiceDEV,OU=test,DC=example,DC=com|CN=WebDEV,OU=test,DC=example,DC=com" # 只允许 memberOf 属性为 ServiceDEV 和 WebDEV 的用户访问 ``` #### 2.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ### 3. ApacheDS接入方式 #### 3.1 配置`application-ldap.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-ldap.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-ldap-apacheds-sample.yml)),相关的内容需要按照具体情况调整: ```yml spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 ``` ##### 3.1.1 基于Group过滤用户 从1.3.0版本开始支持基于Group过滤用户,从而可以控制只有特定Group的用户可以登录和使用apollo: ```yml spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "cn" # ldap rdn key userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 group: # 配置ldap group,启用后只有特定group的用户可以登录apollo objectClass: "groupOfNames" # 配置groupClassName groupBase: "ou=group" # group search base groupSearch: "(&(cn=dev))" # group filter groupMembership: "member" # group memberShip eg. member or memberUid ``` #### 3.2 配置`startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,ldap`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,ldap" ``` ## 实现方式三: 接入OIDC 从 1.8.0 版本开始支持 OpenID Connect 登录, 这种实现方式的前提是已经部署了 OpenID Connect 登录服务 配置前需要准备: * OpenID Connect 的提供者配置端点(符合 RFC 8414 标准的 issuer-uri), 需要是 **https** 的, 例如 https://host:port/auth/realms/apollo/.well-known/openid-configuration * 在 OpenID Connect 服务里创建一个 client, idToken 的签名算法必须设置为 **RS256**, 获取 client-id 以及对应的 client-secret ### 1. 配置 `application-oidc.yml` 解压`apollo-portal-x.x.x-github.zip`后,在`config`目录下创建`application-oidc.yml`,内容参考如下([样例](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/config/application-oidc-sample.yml)),相关的内容需要按照具体情况调整: #### 1.1 最小配置 ```yml spring: security: oauth2: client: provider: # provider-name 是 oidc 提供者的名称, 任意字符均可, registration 的配置需要用到这个名称 provider-name: # 必须是 https, oidc 的 issuer-uri # 例如 你的 issuer-uri 是 https://host:port/auth/realms/apollo/.well-known/openid-configuration, 那么此处只需要配置 https://host:port/auth/realms/apollo 即可, spring boot 处理的时候会加上 /.well-known/openid-configuration 的后缀 issuer-uri: https://host:port/auth/realms/apollo registration: # registration-name 是 oidc 客户端的名称, 任意字符均可, oidc 登录必须配置一个 authorization_code 类型的 registration registration-name: # oidc 登录必须配置一个 authorization_code 类型的 registration authorization-grant-type: authorization_code client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider # 从安全角度考虑更推荐使用环境变量来配置, 环境变量的命名规则为: 将配置项的 key 当中的 点(.)、横杠(-)替换为下划线(_), 然后将所有字母改为大写, spring boot 会自动处理符合此规则的环境变量 # 例如 spring.security.oauth2.client.registration.registration-name.client-secret -> SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_NAME_VDISK_CLIENT_SECRET (REGISTRATION_NAME 可以替换为自定义的 oidc 客户端的名称) client-secret: d43c91c0-xxxx-xxxx-xxxx-xxxxxxxxxxxx ``` #### 1.2 扩展配置 * 如果 OpenID Connect 登录服务支持 client_credentials 模式, 还可以再配置一个 client_credentials 类型的 registration, 用于 apollo-portal 作为客户端请求其它被 oidc 保护的资源 * 如果 OpenID Connect 登录服务支持 jwt, 还可以配置 ${spring.security.oauth2.resourceserver.jwt.issuer-uri}, 以支持通过 jwt 访问 apollo-portal ```yml spring: security: oauth2: client: provider: # provider-name 是 oidc 提供者的名称, 任意字符均可, registration 的配置需要用到这个名称 provider-name: # 必须是 https, oidc 的 issuer-uri, 和 jwt 的 issuer-uri 一致的话直接引用即可, 也可以单独设置 issuer-uri: ${spring.security.oauth2.resourceserver.jwt.issuer-uri} registration: # registration-name 是 oidc 客户端的名称, 任意字符均可, oidc 登录必须配置一个 authorization_code 类型的 registration registration-name: # oidc 登录必须配置一个 authorization_code 类型的 registration authorization-grant-type: authorization_code client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider # 从安全角度考虑更推荐使用环境变量来配置, 环境变量的命名规则为: 将配置项的 key 当中的 点(.)、横杠(-)替换为下划线(_), 然后将所有字母改为大写, spring boot 会自动处理符合此规则的环境变量 # 例如 spring.security.oauth2.client.registration.registration-name.client-secret -> SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_NAME_VDISK_CLIENT_SECRET (REGISTRATION_NAME 可以替换为自定义的 oidc 客户端的名称) client-secret: d43c91c0-xxxx-xxxx-xxxx-xxxxxxxxxxxx # registration-name-client 是 oidc 客户端的名称, 任意字符均可, client_credentials 类型的 registration 为选填项, 可以不配置 registration-name-client: # client_credentials 类型的 registration 为选填项, 用于 apollo-portal 作为客户端请求其它被 oidc 保护的资源, 可以不配置 authorization-grant-type: client_credentials client-authentication-method: basic # client-id 是在 oidc 提供者处配置的客户端ID, 用于登录 provider client-id: apollo-portal # provider 的名称, 需要和上面配置的 provider 名称保持一致 provider: provider-name # openid 为 oidc 登录的必须 scope, 此处可以添加其它自定义的 scope scope: - openid # client-secret 是在 oidc 提供者处配置的客户端密码, 用于登录 provider, 多个 registration 的密码如果一致可以直接引用 client-secret: ${spring.security.oauth2.client.registration.registration-name.client-secret} resourceserver: jwt: # 必须是 https, jwt 的 issuer-uri # 例如 你的 issuer-uri 是 https://host:port/auth/realms/apollo/.well-known/openid-configuration, 那么此处只需要配置 https://host:port/auth/realms/apollo 即可, spring boot 处理的时候会自动加上 /.well-known/openid-configuration 的后缀 issuer-uri: https://host:port/auth/realms/apollo ``` ### 2. 配置 `startup.sh` 修改`scripts/startup.sh`,指定`spring.profiles.active`为`github,oidc`。 ```bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=/opt/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 export JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=github,oidc" ``` ## 实现方式四: 接入公司的统一登录认证系统 这种实现方式的前提是公司已经有统一的登录认证系统,最常见的比如SSO、LDAP等。接入时,实现以下SPI。其中UserService和UserInfoHolder是必须要实现的。 接口说明如下: * UserService(Required):用户服务,用来给Portal提供用户搜索相关功能 * UserInfoHolder(Required):获取当前登录用户信息,SSO一般都是把当前登录用户信息放在线程ThreadLocal上 * LogoutHandler(Optional):用来实现登出功能 * SsoHeartbeatHandler(Optional):Portal页面如果长时间不刷新,登录信息会过期。通过此接口来刷新登录信息 可以参考apollo-portal下的[com.ctrip.framework.apollo.portal.spi](https://github.com/ctripcorp/apollo/tree/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi)这个包下面的四个实现: 1. defaultimpl:默认实现,全局只有apollo一个账号 2. ctrip:ctrip实现,接入了SSO并实现用户搜索、查询接口 3. springsecurity: spring security实现,可以新增用户,修改用户密码等 4. ldap: [@pandalin](https://github.com/pandalin)和[codepiano](https://github.com/codepiano)贡献的ldap实现 实现了相关接口后,可以通过[com.ctrip.framework.apollo.portal.configuration.AuthConfiguration](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java)在运行时替换默认的实现。 接入SSO的思路如下: 1. SSO会提供一个jar包,需要配置一个filter 2. filter会拦截所有请求,检查是否已经登录 3. 如果没有登录,那么就会跳转到SSO的登录页面 4. 在SSO登录页面登录成功后,会跳转回apollo的页面,带上认证的信息 5. 再次进入SSO的filter,校验认证信息,把用户的信息保存下来,并且把用户凭证写入cookie或分布式session,以免下次还要重新登录 6. 进入Apollo的代码,Apollo的代码会调用UserInfoHolder.getUser获取当前登录用户 注意,以上1-5这几步都是SSO的代码,不是Apollo的代码,Apollo的代码只需要你实现第6步。 >注:运行时使用不同的实现是通过[Profiles](http://docs.spring.io/autorepo/docs/spring-boot/current/reference/html/boot-features-profiles.html)实现的,比如你自己的sso实现是在`custom` profile中的话,在打包脚本中可以指定-Dapollo_profile=github,custom。其中`github`是Apollo必须的一个profile,用于数据库的配置,`custom`是你自己实现的profile。同时需要注意在[AuthConfiguration](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java)中修改默认实现的条件 ,从`@ConditionalOnMissingProfile({"ctrip", "auth", "ldap"})`改为`@ConditionalOnMissingProfile({"ctrip", "auth", "ldap", "custom"})`。
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/ApolloProcessor.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.LinkedList; import java.util.List; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.core.Ordered; import org.springframework.core.PriorityOrdered; import org.springframework.util.ReflectionUtils; /** * Create by zhangzheng on 2018/2/6 */ public abstract class ApolloProcessor implements BeanPostProcessor, PriorityOrdered { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { Class clazz = bean.getClass(); for (Field field : findAllField(clazz)) { processField(bean, beanName, field); } for (Method method : findAllMethod(clazz)) { processMethod(bean, beanName, method); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } /** * subclass should implement this method to process field */ protected abstract void processField(Object bean, String beanName, Field field); /** * subclass should implement this method to process method */ protected abstract void processMethod(Object bean, String beanName, Method method); @Override public int getOrder() { //make it as late as possible return Ordered.LOWEST_PRECEDENCE; } private List<Field> findAllField(Class clazz) { final List<Field> res = new LinkedList<>(); ReflectionUtils.doWithFields(clazz, new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { res.add(field); } }); return res; } private List<Method> findAllMethod(Class clazz) { final List<Method> res = new LinkedList<>(); ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { res.add(method); } }); return res; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.LinkedList; import java.util.List; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.core.Ordered; import org.springframework.core.PriorityOrdered; import org.springframework.util.ReflectionUtils; /** * Create by zhangzheng on 2018/2/6 */ public abstract class ApolloProcessor implements BeanPostProcessor, PriorityOrdered { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { Class clazz = bean.getClass(); for (Field field : findAllField(clazz)) { processField(bean, beanName, field); } for (Method method : findAllMethod(clazz)) { processMethod(bean, beanName, method); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } /** * subclass should implement this method to process field */ protected abstract void processField(Object bean, String beanName, Field field); /** * subclass should implement this method to process method */ protected abstract void processMethod(Object bean, String beanName, Method method); @Override public int getOrder() { //make it as late as possible return Ordered.LOWEST_PRECEDENCE; } private List<Field> findAllField(Class clazz) { final List<Field> res = new LinkedList<>(); ReflectionUtils.doWithFields(clazz, new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { res.add(field); } }); return res; } private List<Method> findAllMethod(Class clazz) { final List<Method> res = new LinkedList<>(); ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { res.add(method); } }); return res; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/ApolloConfig.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.ctrip.framework.apollo.core.ConfigConsts; /** * Use this annotation to inject Apollo Config Instance. * * <p>Usage example:</p> * <pre class="code"> * //Inject the config for "someNamespace" * &#064;ApolloConfig("someNamespace") * private Config config; * </pre> * * <p>Usage example with placeholder:</p> * <pre class="code"> * // The namespace could also be specified as a placeholder, e.g. ${redis.namespace:xxx}, * // which will use the value of the key "redis.namespace" or "xxx" if this key is not configured. * &#064;ApolloConfig("${redis.namespace:xxx}") * private Config config; * </pre> * * * @author Jason Song([email protected]) */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @Documented public @interface ApolloConfig { /** * Apollo namespace for the config, if not specified then default to application */ String value() default ConfigConsts.NAMESPACE_APPLICATION; }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.ctrip.framework.apollo.core.ConfigConsts; /** * Use this annotation to inject Apollo Config Instance. * * <p>Usage example:</p> * <pre class="code"> * //Inject the config for "someNamespace" * &#064;ApolloConfig("someNamespace") * private Config config; * </pre> * * <p>Usage example with placeholder:</p> * <pre class="code"> * // The namespace could also be specified as a placeholder, e.g. ${redis.namespace:xxx}, * // which will use the value of the key "redis.namespace" or "xxx" if this key is not configured. * &#064;ApolloConfig("${redis.namespace:xxx}") * private Config config; * </pre> * * * @author Jason Song([email protected]) */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @Documented public @interface ApolloConfig { /** * Apollo namespace for the config, if not specified then default to application */ String value() default ConfigConsts.NAMESPACE_APPLICATION; }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/PreAcquireNamespaceLock.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.aop; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * 标识方法需要获取到namespace的lock才能执行 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface PreAcquireNamespaceLock { }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.aop; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * 标识方法需要获取到namespace的lock才能执行 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface PreAcquireNamespaceLock { }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileControllerTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.google.common.cache.Cache; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import java.lang.reflect.Type; import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ConfigFileControllerTest { @Mock private ConfigController configController; @Mock private WatchKeysUtil watchKeysUtil; @Mock private NamespaceUtil namespaceUtil; @Mock private GrayReleaseRulesHolder grayReleaseRulesHolder; private ConfigFileController configFileController; private String someAppId; private String someClusterName; private String someNamespace; private String someDataCenter; private String someClientIp; @Mock private HttpServletResponse someResponse; @Mock private HttpServletRequest someRequest; Multimap<String, String> watchedKeys2CacheKey; Multimap<String, String> cacheKey2WatchedKeys; private static final Gson GSON = new Gson(); @Before public void setUp() throws Exception { configFileController = new ConfigFileController( configController, namespaceUtil, watchKeysUtil, grayReleaseRulesHolder ); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespace = "someNamespace"; someDataCenter = "someDataCenter"; someClientIp = "10.1.1.1"; when(namespaceUtil.filterNamespaceName(someNamespace)).thenReturn(someNamespace); when(namespaceUtil.normalizeNamespace(someAppId, someNamespace)).thenReturn(someNamespace); when(grayReleaseRulesHolder.hasGrayReleaseRule(anyString(), anyString(), anyString())) .thenReturn(false); watchedKeys2CacheKey = (Multimap<String, String>) ReflectionTestUtils .getField(configFileController, "watchedKeys2CacheKey"); cacheKey2WatchedKeys = (Multimap<String, String>) ReflectionTestUtils .getField(configFileController, "cacheKey2WatchedKeys"); } @Test public void testQueryConfigAsProperties() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherKey = "anotherKey"; String anotherValue = "anotherValue"; String someWatchKey = "someWatchKey"; String anotherWatchKey = "anotherWatchKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); String cacheKey = configFileController .assembleCacheKey(ConfigFileController.ConfigFileOutputFormat.PROPERTIES, someAppId, someClusterName, someNamespace, someDataCenter); Map<String, String> configurations = ImmutableMap.of(someKey, someValue, anotherKey, anotherValue); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someClusterName, someNamespace, someDataCenter)) .thenReturn(watchKeys); ResponseEntity<String> response = configFileController .queryConfigAsProperties(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(2, watchedKeys2CacheKey.size()); assertEquals(2, cacheKey2WatchedKeys.size()); assertTrue(watchedKeys2CacheKey.containsEntry(someWatchKey, cacheKey)); assertTrue(watchedKeys2CacheKey.containsEntry(anotherWatchKey, cacheKey)); assertTrue(cacheKey2WatchedKeys.containsEntry(cacheKey, someWatchKey)); assertTrue(cacheKey2WatchedKeys.containsEntry(cacheKey, anotherWatchKey)); assertEquals(HttpStatus.OK, response.getStatusCode()); assertTrue(response.getBody().contains(String.format("%s=%s", someKey, someValue))); assertTrue(response.getBody().contains(String.format("%s=%s", anotherKey, anotherValue))); ResponseEntity<String> anotherResponse = configFileController .queryConfigAsProperties(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(response, anotherResponse); verify(configController, times(1)) .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse); } @Test public void testQueryConfigAsJson() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Type responseType = new TypeToken<Map<String, String>>(){}.getType(); String someWatchKey = "someWatchKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); Map<String, String> configurations = ImmutableMap.of(someKey, someValue); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someClusterName, someNamespace, someDataCenter)) .thenReturn(watchKeys); ResponseEntity<String> response = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(configurations, GSON.fromJson(response.getBody(), responseType)); } @Test public void testQueryConfigWithGrayRelease() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Type responseType = new TypeToken<Map<String, String>>(){}.getType(); Map<String, String> configurations = ImmutableMap.of(someKey, someValue); when(grayReleaseRulesHolder.hasGrayReleaseRule(someAppId, someClientIp, someNamespace)) .thenReturn(true); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); ResponseEntity<String> response = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); ResponseEntity<String> anotherResponse = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); verify(configController, times(2)) .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(configurations, GSON.fromJson(response.getBody(), responseType)); assertTrue(watchedKeys2CacheKey.isEmpty()); assertTrue(cacheKey2WatchedKeys.isEmpty()); } @Test public void testHandleMessage() throws Exception { String someWatchKey = "someWatchKey"; String anotherWatchKey = "anotherWatchKey"; String someCacheKey = "someCacheKey"; String anotherCacheKey = "anotherCacheKey"; String someValue = "someValue"; ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class); when(someReleaseMessage.getMessage()).thenReturn(someWatchKey); Cache<String, String> cache = (Cache<String, String>) ReflectionTestUtils.getField(configFileController, "localCache"); cache.put(someCacheKey, someValue); cache.put(anotherCacheKey, someValue); watchedKeys2CacheKey.putAll(someWatchKey, Lists.newArrayList(someCacheKey, anotherCacheKey)); watchedKeys2CacheKey.putAll(anotherWatchKey, Lists.newArrayList(someCacheKey, anotherCacheKey)); cacheKey2WatchedKeys.putAll(someCacheKey, Lists.newArrayList(someWatchKey, anotherWatchKey)); cacheKey2WatchedKeys.putAll(anotherCacheKey, Lists.newArrayList(someWatchKey, anotherWatchKey)); configFileController.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); assertTrue(watchedKeys2CacheKey.isEmpty()); assertTrue(cacheKey2WatchedKeys.isEmpty()); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.google.common.cache.Cache; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import java.lang.reflect.Type; import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ConfigFileControllerTest { @Mock private ConfigController configController; @Mock private WatchKeysUtil watchKeysUtil; @Mock private NamespaceUtil namespaceUtil; @Mock private GrayReleaseRulesHolder grayReleaseRulesHolder; private ConfigFileController configFileController; private String someAppId; private String someClusterName; private String someNamespace; private String someDataCenter; private String someClientIp; @Mock private HttpServletResponse someResponse; @Mock private HttpServletRequest someRequest; Multimap<String, String> watchedKeys2CacheKey; Multimap<String, String> cacheKey2WatchedKeys; private static final Gson GSON = new Gson(); @Before public void setUp() throws Exception { configFileController = new ConfigFileController( configController, namespaceUtil, watchKeysUtil, grayReleaseRulesHolder ); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespace = "someNamespace"; someDataCenter = "someDataCenter"; someClientIp = "10.1.1.1"; when(namespaceUtil.filterNamespaceName(someNamespace)).thenReturn(someNamespace); when(namespaceUtil.normalizeNamespace(someAppId, someNamespace)).thenReturn(someNamespace); when(grayReleaseRulesHolder.hasGrayReleaseRule(anyString(), anyString(), anyString())) .thenReturn(false); watchedKeys2CacheKey = (Multimap<String, String>) ReflectionTestUtils .getField(configFileController, "watchedKeys2CacheKey"); cacheKey2WatchedKeys = (Multimap<String, String>) ReflectionTestUtils .getField(configFileController, "cacheKey2WatchedKeys"); } @Test public void testQueryConfigAsProperties() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherKey = "anotherKey"; String anotherValue = "anotherValue"; String someWatchKey = "someWatchKey"; String anotherWatchKey = "anotherWatchKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); String cacheKey = configFileController .assembleCacheKey(ConfigFileController.ConfigFileOutputFormat.PROPERTIES, someAppId, someClusterName, someNamespace, someDataCenter); Map<String, String> configurations = ImmutableMap.of(someKey, someValue, anotherKey, anotherValue); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someClusterName, someNamespace, someDataCenter)) .thenReturn(watchKeys); ResponseEntity<String> response = configFileController .queryConfigAsProperties(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(2, watchedKeys2CacheKey.size()); assertEquals(2, cacheKey2WatchedKeys.size()); assertTrue(watchedKeys2CacheKey.containsEntry(someWatchKey, cacheKey)); assertTrue(watchedKeys2CacheKey.containsEntry(anotherWatchKey, cacheKey)); assertTrue(cacheKey2WatchedKeys.containsEntry(cacheKey, someWatchKey)); assertTrue(cacheKey2WatchedKeys.containsEntry(cacheKey, anotherWatchKey)); assertEquals(HttpStatus.OK, response.getStatusCode()); assertTrue(response.getBody().contains(String.format("%s=%s", someKey, someValue))); assertTrue(response.getBody().contains(String.format("%s=%s", anotherKey, anotherValue))); ResponseEntity<String> anotherResponse = configFileController .queryConfigAsProperties(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(response, anotherResponse); verify(configController, times(1)) .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse); } @Test public void testQueryConfigAsJson() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Type responseType = new TypeToken<Map<String, String>>(){}.getType(); String someWatchKey = "someWatchKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); Map<String, String> configurations = ImmutableMap.of(someKey, someValue); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someClusterName, someNamespace, someDataCenter)) .thenReturn(watchKeys); ResponseEntity<String> response = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(configurations, GSON.fromJson(response.getBody(), responseType)); } @Test public void testQueryConfigWithGrayRelease() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Type responseType = new TypeToken<Map<String, String>>(){}.getType(); Map<String, String> configurations = ImmutableMap.of(someKey, someValue); when(grayReleaseRulesHolder.hasGrayReleaseRule(someAppId, someClientIp, someNamespace)) .thenReturn(true); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getConfigurations()).thenReturn(configurations); when(configController .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse)).thenReturn(someApolloConfig); ResponseEntity<String> response = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); ResponseEntity<String> anotherResponse = configFileController .queryConfigAsJson(someAppId, someClusterName, someNamespace, someDataCenter, someClientIp, someRequest, someResponse); verify(configController, times(2)) .queryConfig(someAppId, someClusterName, someNamespace, someDataCenter, "-1", someClientIp, null, someRequest, someResponse); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(configurations, GSON.fromJson(response.getBody(), responseType)); assertTrue(watchedKeys2CacheKey.isEmpty()); assertTrue(cacheKey2WatchedKeys.isEmpty()); } @Test public void testHandleMessage() throws Exception { String someWatchKey = "someWatchKey"; String anotherWatchKey = "anotherWatchKey"; String someCacheKey = "someCacheKey"; String anotherCacheKey = "anotherCacheKey"; String someValue = "someValue"; ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class); when(someReleaseMessage.getMessage()).thenReturn(someWatchKey); Cache<String, String> cache = (Cache<String, String>) ReflectionTestUtils.getField(configFileController, "localCache"); cache.put(someCacheKey, someValue); cache.put(anotherCacheKey, someValue); watchedKeys2CacheKey.putAll(someWatchKey, Lists.newArrayList(someCacheKey, anotherCacheKey)); watchedKeys2CacheKey.putAll(anotherWatchKey, Lists.newArrayList(someCacheKey, anotherCacheKey)); cacheKey2WatchedKeys.putAll(someCacheKey, Lists.newArrayList(someWatchKey, anotherWatchKey)); cacheKey2WatchedKeys.putAll(anotherCacheKey, Lists.newArrayList(someWatchKey, anotherWatchKey)); configFileController.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); assertTrue(watchedKeys2CacheKey.isEmpty()); assertTrue(cacheKey2WatchedKeys.isEmpty()); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/PlaceholderHelper.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.property; import com.google.common.base.Strings; import com.google.common.collect.Sets; import java.util.Set; import java.util.Stack; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanExpressionContext; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.Scope; import org.springframework.util.StringUtils; /** * Placeholder helper functions. */ public class PlaceholderHelper { private static final String PLACEHOLDER_PREFIX = "${"; private static final String PLACEHOLDER_SUFFIX = "}"; private static final String VALUE_SEPARATOR = ":"; private static final String SIMPLE_PLACEHOLDER_PREFIX = "{"; private static final String EXPRESSION_PREFIX = "#{"; private static final String EXPRESSION_SUFFIX = "}"; /** * Resolve placeholder property values, e.g. * <br /> * <br /> * "${somePropertyValue}" -> "the actual property value" */ public Object resolvePropertyValue(ConfigurableBeanFactory beanFactory, String beanName, String placeholder) { // resolve string value String strVal = beanFactory.resolveEmbeddedValue(placeholder); BeanDefinition bd = (beanFactory.containsBean(beanName) ? beanFactory .getMergedBeanDefinition(beanName) : null); // resolve expressions like "#{systemProperties.myProp}" return evaluateBeanDefinitionString(beanFactory, strVal, bd); } private Object evaluateBeanDefinitionString(ConfigurableBeanFactory beanFactory, String value, BeanDefinition beanDefinition) { if (beanFactory.getBeanExpressionResolver() == null) { return value; } Scope scope = (beanDefinition != null ? beanFactory .getRegisteredScope(beanDefinition.getScope()) : null); return beanFactory.getBeanExpressionResolver() .evaluate(value, new BeanExpressionContext(beanFactory, scope)); } /** * Extract keys from placeholder, e.g. * <ul> * <li>${some.key} => "some.key"</li> * <li>${some.key:${some.other.key:100}} => "some.key", "some.other.key"</li> * <li>${${some.key}} => "some.key"</li> * <li>${${some.key:other.key}} => "some.key"</li> * <li>${${some.key}:${another.key}} => "some.key", "another.key"</li> * <li>#{new java.text.SimpleDateFormat('${some.key}').parse('${another.key}')} => "some.key", "another.key"</li> * </ul> */ public Set<String> extractPlaceholderKeys(String propertyString) { Set<String> placeholderKeys = Sets.newHashSet(); if (Strings.isNullOrEmpty(propertyString) || (!isNormalizedPlaceholder(propertyString) && !isExpressionWithPlaceholder(propertyString))) { return placeholderKeys; } Stack<String> stack = new Stack<>(); stack.push(propertyString); while (!stack.isEmpty()) { String strVal = stack.pop(); int startIndex = strVal.indexOf(PLACEHOLDER_PREFIX); if (startIndex == -1) { placeholderKeys.add(strVal); continue; } int endIndex = findPlaceholderEndIndex(strVal, startIndex); if (endIndex == -1) { // invalid placeholder? continue; } String placeholderCandidate = strVal.substring(startIndex + PLACEHOLDER_PREFIX.length(), endIndex); // ${some.key:other.key} if (placeholderCandidate.startsWith(PLACEHOLDER_PREFIX)) { stack.push(placeholderCandidate); } else { // some.key:${some.other.key:100} int separatorIndex = placeholderCandidate.indexOf(VALUE_SEPARATOR); if (separatorIndex == -1) { stack.push(placeholderCandidate); } else { stack.push(placeholderCandidate.substring(0, separatorIndex)); String defaultValuePart = normalizeToPlaceholder(placeholderCandidate.substring(separatorIndex + VALUE_SEPARATOR.length())); if (!Strings.isNullOrEmpty(defaultValuePart)) { stack.push(defaultValuePart); } } } // has remaining part, e.g. ${a}.${b} if (endIndex + PLACEHOLDER_SUFFIX.length() < strVal.length() - 1) { String remainingPart = normalizeToPlaceholder(strVal.substring(endIndex + PLACEHOLDER_SUFFIX.length())); if (!Strings.isNullOrEmpty(remainingPart)) { stack.push(remainingPart); } } } return placeholderKeys; } private boolean isNormalizedPlaceholder(String propertyString) { return propertyString.startsWith(PLACEHOLDER_PREFIX) && propertyString.contains(PLACEHOLDER_SUFFIX); } private boolean isExpressionWithPlaceholder(String propertyString) { return propertyString.startsWith(EXPRESSION_PREFIX) && propertyString.contains(EXPRESSION_SUFFIX) && propertyString.contains(PLACEHOLDER_PREFIX) && propertyString.contains(PLACEHOLDER_SUFFIX); } private String normalizeToPlaceholder(String strVal) { int startIndex = strVal.indexOf(PLACEHOLDER_PREFIX); if (startIndex == -1) { return null; } int endIndex = strVal.lastIndexOf(PLACEHOLDER_SUFFIX); if (endIndex == -1) { return null; } return strVal.substring(startIndex, endIndex + PLACEHOLDER_SUFFIX.length()); } private int findPlaceholderEndIndex(CharSequence buf, int startIndex) { int index = startIndex + PLACEHOLDER_PREFIX.length(); int withinNestedPlaceholder = 0; while (index < buf.length()) { if (StringUtils.substringMatch(buf, index, PLACEHOLDER_SUFFIX)) { if (withinNestedPlaceholder > 0) { withinNestedPlaceholder--; index = index + PLACEHOLDER_SUFFIX.length(); } else { return index; } } else if (StringUtils.substringMatch(buf, index, SIMPLE_PLACEHOLDER_PREFIX)) { withinNestedPlaceholder++; index = index + SIMPLE_PLACEHOLDER_PREFIX.length(); } else { index++; } } return -1; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.spring.property; import com.google.common.base.Strings; import com.google.common.collect.Sets; import java.util.Set; import java.util.Stack; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanExpressionContext; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.Scope; import org.springframework.util.StringUtils; /** * Placeholder helper functions. */ public class PlaceholderHelper { private static final String PLACEHOLDER_PREFIX = "${"; private static final String PLACEHOLDER_SUFFIX = "}"; private static final String VALUE_SEPARATOR = ":"; private static final String SIMPLE_PLACEHOLDER_PREFIX = "{"; private static final String EXPRESSION_PREFIX = "#{"; private static final String EXPRESSION_SUFFIX = "}"; /** * Resolve placeholder property values, e.g. * <br /> * <br /> * "${somePropertyValue}" -> "the actual property value" */ public Object resolvePropertyValue(ConfigurableBeanFactory beanFactory, String beanName, String placeholder) { // resolve string value String strVal = beanFactory.resolveEmbeddedValue(placeholder); BeanDefinition bd = (beanFactory.containsBean(beanName) ? beanFactory .getMergedBeanDefinition(beanName) : null); // resolve expressions like "#{systemProperties.myProp}" return evaluateBeanDefinitionString(beanFactory, strVal, bd); } private Object evaluateBeanDefinitionString(ConfigurableBeanFactory beanFactory, String value, BeanDefinition beanDefinition) { if (beanFactory.getBeanExpressionResolver() == null) { return value; } Scope scope = (beanDefinition != null ? beanFactory .getRegisteredScope(beanDefinition.getScope()) : null); return beanFactory.getBeanExpressionResolver() .evaluate(value, new BeanExpressionContext(beanFactory, scope)); } /** * Extract keys from placeholder, e.g. * <ul> * <li>${some.key} => "some.key"</li> * <li>${some.key:${some.other.key:100}} => "some.key", "some.other.key"</li> * <li>${${some.key}} => "some.key"</li> * <li>${${some.key:other.key}} => "some.key"</li> * <li>${${some.key}:${another.key}} => "some.key", "another.key"</li> * <li>#{new java.text.SimpleDateFormat('${some.key}').parse('${another.key}')} => "some.key", "another.key"</li> * </ul> */ public Set<String> extractPlaceholderKeys(String propertyString) { Set<String> placeholderKeys = Sets.newHashSet(); if (Strings.isNullOrEmpty(propertyString) || (!isNormalizedPlaceholder(propertyString) && !isExpressionWithPlaceholder(propertyString))) { return placeholderKeys; } Stack<String> stack = new Stack<>(); stack.push(propertyString); while (!stack.isEmpty()) { String strVal = stack.pop(); int startIndex = strVal.indexOf(PLACEHOLDER_PREFIX); if (startIndex == -1) { placeholderKeys.add(strVal); continue; } int endIndex = findPlaceholderEndIndex(strVal, startIndex); if (endIndex == -1) { // invalid placeholder? continue; } String placeholderCandidate = strVal.substring(startIndex + PLACEHOLDER_PREFIX.length(), endIndex); // ${some.key:other.key} if (placeholderCandidate.startsWith(PLACEHOLDER_PREFIX)) { stack.push(placeholderCandidate); } else { // some.key:${some.other.key:100} int separatorIndex = placeholderCandidate.indexOf(VALUE_SEPARATOR); if (separatorIndex == -1) { stack.push(placeholderCandidate); } else { stack.push(placeholderCandidate.substring(0, separatorIndex)); String defaultValuePart = normalizeToPlaceholder(placeholderCandidate.substring(separatorIndex + VALUE_SEPARATOR.length())); if (!Strings.isNullOrEmpty(defaultValuePart)) { stack.push(defaultValuePart); } } } // has remaining part, e.g. ${a}.${b} if (endIndex + PLACEHOLDER_SUFFIX.length() < strVal.length() - 1) { String remainingPart = normalizeToPlaceholder(strVal.substring(endIndex + PLACEHOLDER_SUFFIX.length())); if (!Strings.isNullOrEmpty(remainingPart)) { stack.push(remainingPart); } } } return placeholderKeys; } private boolean isNormalizedPlaceholder(String propertyString) { return propertyString.startsWith(PLACEHOLDER_PREFIX) && propertyString.contains(PLACEHOLDER_SUFFIX); } private boolean isExpressionWithPlaceholder(String propertyString) { return propertyString.startsWith(EXPRESSION_PREFIX) && propertyString.contains(EXPRESSION_SUFFIX) && propertyString.contains(PLACEHOLDER_PREFIX) && propertyString.contains(PLACEHOLDER_SUFFIX); } private String normalizeToPlaceholder(String strVal) { int startIndex = strVal.indexOf(PLACEHOLDER_PREFIX); if (startIndex == -1) { return null; } int endIndex = strVal.lastIndexOf(PLACEHOLDER_SUFFIX); if (endIndex == -1) { return null; } return strVal.substring(startIndex, endIndex + PLACEHOLDER_SUFFIX.length()); } private int findPlaceholderEndIndex(CharSequence buf, int startIndex) { int index = startIndex + PLACEHOLDER_PREFIX.length(); int withinNestedPlaceholder = 0; while (index < buf.length()) { if (StringUtils.substringMatch(buf, index, PLACEHOLDER_SUFFIX)) { if (withinNestedPlaceholder > 0) { withinNestedPlaceholder--; index = index + PLACEHOLDER_SUFFIX.length(); } else { return index; } } else if (StringUtils.substringMatch(buf, index, SIMPLE_PLACEHOLDER_PREFIX)) { withinNestedPlaceholder++; index = index + SIMPLE_PLACEHOLDER_PREFIX.length(); } else { index++; } } return -1; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/java/com/ctrip/framework/apollo/integration/ConfigIntegrationTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.integration; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.util.OrderedProperties; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; import com.ctrip.framework.apollo.BaseIntegrationTest; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigChangeListener; import com.ctrip.framework.apollo.ConfigService; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil; import com.ctrip.framework.apollo.internals.RemoteConfigLongPollService; import com.ctrip.framework.apollo.model.ConfigChangeEvent; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.util.concurrent.SettableFuture; /** * @author Jason Song([email protected]) */ public class ConfigIntegrationTest extends BaseIntegrationTest { private String someReleaseKey; private File configDir; private String defaultNamespace; private String someOtherNamespace; private RemoteConfigLongPollService remoteConfigLongPollService; @Before public void setUp() throws Exception { super.setUp(); defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION; someOtherNamespace = "someOtherNamespace"; someReleaseKey = "1"; configDir = new File(ClassLoaderUtil.getClassPath() + "config-cache"); if (configDir.exists()) { configDir.delete(); } configDir.mkdirs(); remoteConfigLongPollService = ApolloInjector.getInstance(RemoteConfigLongPollService.class); } @Override @After public void tearDown() throws Exception { ReflectionTestUtils.invokeMethod(remoteConfigLongPollService, "stopLongPollingRefresh"); recursiveDelete(configDir); super.tearDown(); } private void recursiveDelete(File file) { if (!file.exists()) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { recursiveDelete(f); } } try { Files.deleteIfExists(file.toPath()); } catch (IOException e) { e.printStackTrace(); } } @Test public void testGetConfigWithNoLocalFileButWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String someNonExistedKey = "someNonExistedKey"; String someDefaultValue = "someDefaultValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someDefaultValue, config.getProperty(someNonExistedKey, someDefaultValue)); } @Test public void testOrderGetConfigWithNoLocalFileButWithRemoteConfig() throws Exception { setPropertiesOrderEnabled(true); String someKey1 = "someKey1"; String someValue1 = "someValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; Map<String, String> configurations = new LinkedHashMap<>(); configurations.put(someKey1, someValue1); configurations.put(someKey2, someValue2); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.copyOf(configurations)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); } @Test public void testGetConfigWithLocalFileAndWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherValue = "anotherValue"; Properties properties = new Properties(); properties.put(someKey, someValue); createLocalCachePropertyFile(properties); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, anotherValue)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testOrderGetConfigWithLocalFileAndWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherValue = "anotherValue"; String someKey1 = "someKey1"; String someValue1 = "someValue1"; String anotherValue1 = "anotherValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; setPropertiesOrderEnabled(true); Properties properties = new OrderedProperties(); properties.put(someKey, someValue); properties.put(someKey1, someValue1); properties.put(someKey2, someValue2); createLocalCachePropertyFile(properties); Map<String, String> configurations = new LinkedHashMap<>(); configurations.put(someKey, anotherValue); configurations.put(someKey1, anotherValue1); configurations.put(someKey2, someValue2); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.copyOf(configurations)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(anotherValue, config.getProperty(someKey, null)); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey, it.next()); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); assertEquals(anotherValue1, config.getProperty(someKey1, "")); } @Test public void testGetConfigWithNoLocalFileAndRemoteConfigError() throws Exception { ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); String someKey = "someKey"; String someDefaultValue = "defaultValue" + Math.random(); assertEquals(someDefaultValue, config.getProperty(someKey, someDefaultValue)); } @Test public void testGetConfigWithLocalFileAndRemoteConfigError() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Properties properties = new Properties(); properties.put(someKey, someValue); createLocalCachePropertyFile(properties); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testOrderGetConfigWithLocalFileAndRemoteConfigError() throws Exception { String someKey1 = "someKey1"; String someValue1 = "someValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; setPropertiesOrderEnabled(true); Properties properties = new OrderedProperties(); properties.put(someKey1, someValue1); properties.put(someKey2, someValue2); createLocalCachePropertyFile(properties); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue1, config.getProperty(someKey1, null)); assertEquals(someValue2, config.getProperty(someKey2, null)); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); } @Test public void testGetConfigWithNoLocalFileAndRemoteMetaServiceRetry() throws Exception { String someKey = "someKey"; String someValue = "someValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); boolean failAtFirstTime = true; ContextHandler metaServerHandler = mockMetaServerHandler(failAtFirstTime); startServerWithHandlers(metaServerHandler, configHandler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testGetConfigWithNoLocalFileAndRemoteConfigServiceRetry() throws Exception { String someKey = "someKey"; String someValue = "someValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); boolean failedAtFirstTime = true; ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig, failedAtFirstTime); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testRefreshConfig() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; int someRefreshInterval = 500; TimeUnit someRefreshTimeUnit = TimeUnit.MILLISECONDS; setRefreshInterval(someRefreshInterval); setRefreshTimeUnit(someRefreshTimeUnit); Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); final List<ConfigChangeEvent> changeEvents = Lists.newArrayList(); final SettableFuture<Boolean> refreshFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { AtomicInteger counter = new AtomicInteger(0); @Override public void onChange(ConfigChangeEvent changeEvent) { //only need to assert once if (counter.incrementAndGet() > 1) { return; } assertEquals(1, changeEvent.changedKeys().size()); assertTrue(changeEvent.isChanged(someKey)); assertEquals(someValue, changeEvent.getChange(someKey).getOldValue()); assertEquals(anotherValue, changeEvent.getChange(someKey).getNewValue()); // if there is any assertion failed above, this line won't be executed changeEvents.add(changeEvent); refreshFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); refreshFinished.get(someRefreshInterval * 5, someRefreshTimeUnit); assertThat( "Change event's size should equal to one or there must be some assertion failed in change listener", 1, equalTo(changeEvents.size())); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testLongPollRefresh() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(pollTimeoutInMS * 20, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testLongPollRefreshWithMultipleNamespacesAndOnlyOneNamespaceNotified() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config someOtherConfig = ConfigService.getConfig(someOtherNamespace); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(5000, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); TimeUnit.MILLISECONDS.sleep(pollTimeoutInMS * 10); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); } @Test public void testLongPollRefreshWithMultipleNamespacesAndMultipleNamespaceNotified() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId), new ApolloConfigNotification(someOtherNamespace, someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config config = ConfigService.getAppConfig(); Config someOtherConfig = ConfigService.getConfig(someOtherNamespace); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); final SettableFuture<Boolean> someOtherNamespacelongPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); someOtherConfig.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { someOtherNamespacelongPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(5000, TimeUnit.MILLISECONDS); someOtherNamespacelongPollFinished.get(5000, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); assertEquals(anotherValue, someOtherConfig.getProperty(someKey, null)); } private ContextHandler mockPollNotificationHandler(final long pollResultTimeOutInMS, final int statusCode, final List<ApolloConfigNotification> result, final boolean failedAtFirstTime) { ContextHandler context = new ContextHandler("/notifications/v2"); context.setHandler(new AbstractHandler() { AtomicInteger counter = new AtomicInteger(0); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (failedAtFirstTime && counter.incrementAndGet() == 1) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); baseRequest.setHandled(true); return; } try { TimeUnit.MILLISECONDS.sleep(pollResultTimeOutInMS); } catch (InterruptedException e) { } response.setContentType("application/json;charset=UTF-8"); response.setStatus(statusCode); response.getWriter().println(gson.toJson(result)); baseRequest.setHandled(true); } }); return context; } private ContextHandler mockConfigServerHandler(final int statusCode, final ApolloConfig result, final boolean failedAtFirstTime) { ContextHandler context = new ContextHandler("/configs/*"); context.setHandler(new AbstractHandler() { AtomicInteger counter = new AtomicInteger(0); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (failedAtFirstTime && counter.incrementAndGet() == 1) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); baseRequest.setHandled(true); return; } response.setContentType("application/json;charset=UTF-8"); response.setStatus(statusCode); response.getWriter().println(gson.toJson(result)); baseRequest.setHandled(true); } }); return context; } private ContextHandler mockConfigServerHandler(int statusCode, ApolloConfig result) { return mockConfigServerHandler(statusCode, result, false); } private ApolloConfig assembleApolloConfig(Map<String, String> configurations) { ApolloConfig apolloConfig = new ApolloConfig(someAppId, someClusterName, defaultNamespace, someReleaseKey); apolloConfig.setConfigurations(configurations); return apolloConfig; } private File createLocalCachePropertyFile(Properties properties) throws IOException { File file = new File(configDir, assembleLocalCacheFileName()); try (FileOutputStream in = new FileOutputStream(file)) { properties.store(in, "Persisted by ConfigIntegrationTest"); } return file; } private String assembleLocalCacheFileName() { return String.format("%s.properties", Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(someAppId, someClusterName, defaultNamespace)); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.integration; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.util.OrderedProperties; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; import com.ctrip.framework.apollo.BaseIntegrationTest; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigChangeListener; import com.ctrip.framework.apollo.ConfigService; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil; import com.ctrip.framework.apollo.internals.RemoteConfigLongPollService; import com.ctrip.framework.apollo.model.ConfigChangeEvent; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.util.concurrent.SettableFuture; /** * @author Jason Song([email protected]) */ public class ConfigIntegrationTest extends BaseIntegrationTest { private String someReleaseKey; private File configDir; private String defaultNamespace; private String someOtherNamespace; private RemoteConfigLongPollService remoteConfigLongPollService; @Before public void setUp() throws Exception { super.setUp(); defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION; someOtherNamespace = "someOtherNamespace"; someReleaseKey = "1"; configDir = new File(ClassLoaderUtil.getClassPath() + "config-cache"); if (configDir.exists()) { configDir.delete(); } configDir.mkdirs(); remoteConfigLongPollService = ApolloInjector.getInstance(RemoteConfigLongPollService.class); } @Override @After public void tearDown() throws Exception { ReflectionTestUtils.invokeMethod(remoteConfigLongPollService, "stopLongPollingRefresh"); recursiveDelete(configDir); super.tearDown(); } private void recursiveDelete(File file) { if (!file.exists()) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { recursiveDelete(f); } } try { Files.deleteIfExists(file.toPath()); } catch (IOException e) { e.printStackTrace(); } } @Test public void testGetConfigWithNoLocalFileButWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String someNonExistedKey = "someNonExistedKey"; String someDefaultValue = "someDefaultValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someDefaultValue, config.getProperty(someNonExistedKey, someDefaultValue)); } @Test public void testOrderGetConfigWithNoLocalFileButWithRemoteConfig() throws Exception { setPropertiesOrderEnabled(true); String someKey1 = "someKey1"; String someValue1 = "someValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; Map<String, String> configurations = new LinkedHashMap<>(); configurations.put(someKey1, someValue1); configurations.put(someKey2, someValue2); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.copyOf(configurations)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); } @Test public void testGetConfigWithLocalFileAndWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherValue = "anotherValue"; Properties properties = new Properties(); properties.put(someKey, someValue); createLocalCachePropertyFile(properties); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, anotherValue)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testOrderGetConfigWithLocalFileAndWithRemoteConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; String anotherValue = "anotherValue"; String someKey1 = "someKey1"; String someValue1 = "someValue1"; String anotherValue1 = "anotherValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; setPropertiesOrderEnabled(true); Properties properties = new OrderedProperties(); properties.put(someKey, someValue); properties.put(someKey1, someValue1); properties.put(someKey2, someValue2); createLocalCachePropertyFile(properties); Map<String, String> configurations = new LinkedHashMap<>(); configurations.put(someKey, anotherValue); configurations.put(someKey1, anotherValue1); configurations.put(someKey2, someValue2); ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.copyOf(configurations)); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(anotherValue, config.getProperty(someKey, null)); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey, it.next()); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); assertEquals(anotherValue1, config.getProperty(someKey1, "")); } @Test public void testGetConfigWithNoLocalFileAndRemoteConfigError() throws Exception { ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); String someKey = "someKey"; String someDefaultValue = "defaultValue" + Math.random(); assertEquals(someDefaultValue, config.getProperty(someKey, someDefaultValue)); } @Test public void testGetConfigWithLocalFileAndRemoteConfigError() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Properties properties = new Properties(); properties.put(someKey, someValue); createLocalCachePropertyFile(properties); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testOrderGetConfigWithLocalFileAndRemoteConfigError() throws Exception { String someKey1 = "someKey1"; String someValue1 = "someValue1"; String someKey2 = "someKey2"; String someValue2 = "someValue2"; setPropertiesOrderEnabled(true); Properties properties = new OrderedProperties(); properties.put(someKey1, someValue1); properties.put(someKey2, someValue2); createLocalCachePropertyFile(properties); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue1, config.getProperty(someKey1, null)); assertEquals(someValue2, config.getProperty(someKey2, null)); Set<String> propertyNames = config.getPropertyNames(); Iterator<String> it = propertyNames.iterator(); assertEquals(someKey1, it.next()); assertEquals(someKey2, it.next()); } @Test public void testGetConfigWithNoLocalFileAndRemoteMetaServiceRetry() throws Exception { String someKey = "someKey"; String someValue = "someValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); boolean failAtFirstTime = true; ContextHandler metaServerHandler = mockMetaServerHandler(failAtFirstTime); startServerWithHandlers(metaServerHandler, configHandler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testGetConfigWithNoLocalFileAndRemoteConfigServiceRetry() throws Exception { String someKey = "someKey"; String someValue = "someValue"; ApolloConfig apolloConfig = assembleApolloConfig(ImmutableMap.of(someKey, someValue)); boolean failedAtFirstTime = true; ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig, failedAtFirstTime); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); } @Test public void testRefreshConfig() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; int someRefreshInterval = 500; TimeUnit someRefreshTimeUnit = TimeUnit.MILLISECONDS; setRefreshInterval(someRefreshInterval); setRefreshTimeUnit(someRefreshTimeUnit); Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler handler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); startServerWithHandlers(handler); Config config = ConfigService.getAppConfig(); final List<ConfigChangeEvent> changeEvents = Lists.newArrayList(); final SettableFuture<Boolean> refreshFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { AtomicInteger counter = new AtomicInteger(0); @Override public void onChange(ConfigChangeEvent changeEvent) { //only need to assert once if (counter.incrementAndGet() > 1) { return; } assertEquals(1, changeEvent.changedKeys().size()); assertTrue(changeEvent.isChanged(someKey)); assertEquals(someValue, changeEvent.getChange(someKey).getOldValue()); assertEquals(anotherValue, changeEvent.getChange(someKey).getNewValue()); // if there is any assertion failed above, this line won't be executed changeEvents.add(changeEvent); refreshFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); refreshFinished.get(someRefreshInterval * 5, someRefreshTimeUnit); assertThat( "Change event's size should equal to one or there must be some assertion failed in change listener", 1, equalTo(changeEvents.size())); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testLongPollRefresh() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(pollTimeoutInMS * 20, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); } @Test public void testLongPollRefreshWithMultipleNamespacesAndOnlyOneNamespaceNotified() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config someOtherConfig = ConfigService.getConfig(someOtherNamespace); Config config = ConfigService.getAppConfig(); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(5000, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); TimeUnit.MILLISECONDS.sleep(pollTimeoutInMS * 10); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); } @Test public void testLongPollRefreshWithMultipleNamespacesAndMultipleNamespaceNotified() throws Exception { final String someKey = "someKey"; final String someValue = "someValue"; final String anotherValue = "anotherValue"; long someNotificationId = 1; long pollTimeoutInMS = 50; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig apolloConfig = assembleApolloConfig(configurations); ContextHandler configHandler = mockConfigServerHandler(HttpServletResponse.SC_OK, apolloConfig); ContextHandler pollHandler = mockPollNotificationHandler(pollTimeoutInMS, HttpServletResponse.SC_OK, Lists.newArrayList( new ApolloConfigNotification(apolloConfig.getNamespaceName(), someNotificationId), new ApolloConfigNotification(someOtherNamespace, someNotificationId)), false); startServerWithHandlers(configHandler, pollHandler); Config config = ConfigService.getAppConfig(); Config someOtherConfig = ConfigService.getConfig(someOtherNamespace); assertEquals(someValue, config.getProperty(someKey, null)); assertEquals(someValue, someOtherConfig.getProperty(someKey, null)); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); final SettableFuture<Boolean> someOtherNamespacelongPollFinished = SettableFuture.create(); config.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { longPollFinished.set(true); } }); someOtherConfig.addChangeListener(new ConfigChangeListener() { @Override public void onChange(ConfigChangeEvent changeEvent) { someOtherNamespacelongPollFinished.set(true); } }); apolloConfig.getConfigurations().put(someKey, anotherValue); longPollFinished.get(5000, TimeUnit.MILLISECONDS); someOtherNamespacelongPollFinished.get(5000, TimeUnit.MILLISECONDS); assertEquals(anotherValue, config.getProperty(someKey, null)); assertEquals(anotherValue, someOtherConfig.getProperty(someKey, null)); } private ContextHandler mockPollNotificationHandler(final long pollResultTimeOutInMS, final int statusCode, final List<ApolloConfigNotification> result, final boolean failedAtFirstTime) { ContextHandler context = new ContextHandler("/notifications/v2"); context.setHandler(new AbstractHandler() { AtomicInteger counter = new AtomicInteger(0); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (failedAtFirstTime && counter.incrementAndGet() == 1) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); baseRequest.setHandled(true); return; } try { TimeUnit.MILLISECONDS.sleep(pollResultTimeOutInMS); } catch (InterruptedException e) { } response.setContentType("application/json;charset=UTF-8"); response.setStatus(statusCode); response.getWriter().println(gson.toJson(result)); baseRequest.setHandled(true); } }); return context; } private ContextHandler mockConfigServerHandler(final int statusCode, final ApolloConfig result, final boolean failedAtFirstTime) { ContextHandler context = new ContextHandler("/configs/*"); context.setHandler(new AbstractHandler() { AtomicInteger counter = new AtomicInteger(0); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (failedAtFirstTime && counter.incrementAndGet() == 1) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); baseRequest.setHandled(true); return; } response.setContentType("application/json;charset=UTF-8"); response.setStatus(statusCode); response.getWriter().println(gson.toJson(result)); baseRequest.setHandled(true); } }); return context; } private ContextHandler mockConfigServerHandler(int statusCode, ApolloConfig result) { return mockConfigServerHandler(statusCode, result, false); } private ApolloConfig assembleApolloConfig(Map<String, String> configurations) { ApolloConfig apolloConfig = new ApolloConfig(someAppId, someClusterName, defaultNamespace, someReleaseKey); apolloConfig.setConfigurations(configurations); return apolloConfig; } private File createLocalCachePropertyFile(Properties properties) throws IOException { File file = new File(configDir, assembleLocalCacheFileName()); try (FileOutputStream in = new FileOutputStream(file)) { properties.store(in, "Persisted by ConfigIntegrationTest"); } return file; } private String assembleLocalCacheFileName() { return String.format("%s.properties", Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(someAppId, someClusterName, defaultNamespace)); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/resources/META-INF/apollo-1.0.0.xsd
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <xsd:schema xmlns="http://www.ctrip.com/schema/apollo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ctrip.com/schema/apollo" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:annotation> <xsd:documentation><![CDATA[ Namespace support for Ctrip Apollo Configuration Center. ]]></xsd:documentation> </xsd:annotation> <xsd:element name="config"> <xsd:annotation> <xsd:documentation> <![CDATA[ Apollo configuration section to integrate with Spring.]]> </xsd:documentation> </xsd:annotation> <xsd:complexType> <xsd:attribute name="namespaces" type="xsd:string" use="optional"> <xsd:annotation> <xsd:documentation> <![CDATA[ The comma-separated list of namespace names to integrate with Spring property sources. If not specified, then default to application namespace. ]]> </xsd:documentation> </xsd:annotation> </xsd:attribute> <xsd:attribute name="order" type="xsd:int" use="optional"> <xsd:annotation> <xsd:documentation> <![CDATA[ The order of the config, default to Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE. If there are properties with the same name in different apollo configs, the config with smaller order wins. ]]> </xsd:documentation> </xsd:annotation> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:schema>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <xsd:schema xmlns="http://www.ctrip.com/schema/apollo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ctrip.com/schema/apollo" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:annotation> <xsd:documentation><![CDATA[ Namespace support for Ctrip Apollo Configuration Center. ]]></xsd:documentation> </xsd:annotation> <xsd:element name="config"> <xsd:annotation> <xsd:documentation> <![CDATA[ Apollo configuration section to integrate with Spring.]]> </xsd:documentation> </xsd:annotation> <xsd:complexType> <xsd:attribute name="namespaces" type="xsd:string" use="optional"> <xsd:annotation> <xsd:documentation> <![CDATA[ The comma-separated list of namespace names to integrate with Spring property sources. If not specified, then default to application namespace. ]]> </xsd:documentation> </xsd:annotation> </xsd:attribute> <xsd:attribute name="order" type="xsd:int" use="optional"> <xsd:annotation> <xsd:documentation> <![CDATA[ The order of the config, default to Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE. If there are properties with the same name in different apollo configs, the config with smaller order wins. ]]> </xsd:documentation> </xsd:annotation> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:schema>
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/logback.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-portal.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-portal.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/metaservice/service/NacosDiscoveryServiceTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.metaservice.service; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author kl (http://kailing.pub) * @since 2020/12/21 */ @RunWith(MockitoJUnitRunner.class) public class NacosDiscoveryServiceTest { private NacosDiscoveryService nacosDiscoveryService; @Mock private NamingService nacosNamingService; private String someServiceId; @Before public void setUp() throws Exception { nacosDiscoveryService = new NacosDiscoveryService(); nacosDiscoveryService.setNamingService(nacosNamingService); someServiceId = "someServiceId"; } @Test public void testGetServiceInstancesWithEmptyInstances() throws Exception { assertTrue(nacosNamingService.selectInstances(someServiceId, true).isEmpty()); } @Test public void testGetServiceInstancesWithInvalidServiceId() { assertTrue(nacosDiscoveryService.getServiceInstances(someServiceId).isEmpty()); } @Test public void testGetServiceInstances() throws Exception { String someIp = "1.2.3.4"; int somePort = 8080; String someInstanceId = "someInstanceId"; Instance someServiceInstance = mockServiceInstance(someInstanceId, someIp, somePort); when(nacosNamingService.selectInstances(someServiceId, true)).thenReturn( Lists.newArrayList(someServiceInstance)); List<ServiceDTO> serviceDTOList = nacosDiscoveryService.getServiceInstances(someServiceId); ServiceDTO serviceDTO = serviceDTOList.get(0); assertEquals(1, serviceDTOList.size()); assertEquals(someServiceId, serviceDTO.getAppName()); assertEquals("http://1.2.3.4:8080/", serviceDTO.getHomepageUrl()); } private Instance mockServiceInstance(String instanceId, String ip, int port) { Instance serviceInstance = mock(Instance.class); when(serviceInstance.getInstanceId()).thenReturn(instanceId); when(serviceInstance.getIp()).thenReturn(ip); when(serviceInstance.getPort()).thenReturn(port); return serviceInstance; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.metaservice.service; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author kl (http://kailing.pub) * @since 2020/12/21 */ @RunWith(MockitoJUnitRunner.class) public class NacosDiscoveryServiceTest { private NacosDiscoveryService nacosDiscoveryService; @Mock private NamingService nacosNamingService; private String someServiceId; @Before public void setUp() throws Exception { nacosDiscoveryService = new NacosDiscoveryService(); nacosDiscoveryService.setNamingService(nacosNamingService); someServiceId = "someServiceId"; } @Test public void testGetServiceInstancesWithEmptyInstances() throws Exception { assertTrue(nacosNamingService.selectInstances(someServiceId, true).isEmpty()); } @Test public void testGetServiceInstancesWithInvalidServiceId() { assertTrue(nacosDiscoveryService.getServiceInstances(someServiceId).isEmpty()); } @Test public void testGetServiceInstances() throws Exception { String someIp = "1.2.3.4"; int somePort = 8080; String someInstanceId = "someInstanceId"; Instance someServiceInstance = mockServiceInstance(someInstanceId, someIp, somePort); when(nacosNamingService.selectInstances(someServiceId, true)).thenReturn( Lists.newArrayList(someServiceInstance)); List<ServiceDTO> serviceDTOList = nacosDiscoveryService.getServiceInstances(someServiceId); ServiceDTO serviceDTO = serviceDTOList.get(0); assertEquals(1, serviceDTOList.size()); assertEquals(someServiceId, serviceDTO.getAppName()); assertEquals("http://1.2.3.4:8080/", serviceDTO.getHomepageUrl()); } private Instance mockServiceInstance(String instanceId, String ip, int port) { Instance serviceInstance = mock(Instance.class); when(serviceInstance.getInstanceId()).thenReturn(instanceId); when(serviceInstance.getIp()).thenReturn(ip); when(serviceInstance.getPort()).thenReturn(port); return serviceInstance; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./.git/hooks/pre-receive.sample
#!/bin/sh # # An example hook script to make use of push options. # The example simply echoes all push options that start with 'echoback=' # and rejects all pushes when the "reject" push option is used. # # To enable this hook, rename this file to "pre-receive". if test -n "$GIT_PUSH_OPTION_COUNT" then i=0 while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" do eval "value=\$GIT_PUSH_OPTION_$i" case "$value" in echoback=*) echo "echo from the pre-receive-hook: ${value#*=}" >&2 ;; reject) exit 1 esac i=$((i + 1)) done fi
#!/bin/sh # # An example hook script to make use of push options. # The example simply echoes all push options that start with 'echoback=' # and rejects all pushes when the "reject" push option is used. # # To enable this hook, rename this file to "pre-receive". if test -n "$GIT_PUSH_OPTION_COUNT" then i=0 while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" do eval "value=\$GIT_PUSH_OPTION_$i" case "$value" in echoback=*) echo "echo from the pre-receive-hook: ${value#*=}" >&2 ;; reject) exit 1 esac i=$((i + 1)) done fi
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/filter/AdminServiceAuthenticationIntegrationTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.filter; import com.ctrip.framework.apollo.adminservice.controller.AbstractControllerTest; import com.ctrip.framework.apollo.common.config.RefreshablePropertySource; import com.ctrip.framework.apollo.common.dto.AppDTO; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.client.HttpClientErrorException; @DirtiesContext public class AdminServiceAuthenticationIntegrationTest extends AbstractControllerTest { @Autowired private List<RefreshablePropertySource> propertySources; @Before public void setUp() throws Exception { doRefresh(propertySources); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-disabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlDisabledExplicitly() { String appId = "someAppId"; AppDTO app = restTemplate .getForObject("http://localhost:" + port + "/apps/" + appId, AppDTO.class); Assert.assertEquals("someAppId", app.getAppId()); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-disabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlDisabledExplicitlyWithAccessToken() { String appId = "someAppId"; String someToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithValidAccessToken() { String appId = "someAppId"; String someValidToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someValidToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } @Test(expected = HttpClientErrorException.class) @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithNoAccessToken() { String appId = "someAppId"; AppDTO app = restTemplate .getForObject("http://localhost:" + port + "/apps/" + appId, AppDTO.class); } @Test(expected = HttpClientErrorException.class) @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithInValidAccessToken() { String appId = "someAppId"; String someValidToken = "someInvalidToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someValidToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled-no-token.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithNoTokenSpecified() { String appId = "someAppId"; String someToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } private void doRefresh(List<RefreshablePropertySource> propertySources) { propertySources.forEach(refreshablePropertySource -> ReflectionTestUtils .invokeMethod(refreshablePropertySource, "refresh")); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.adminservice.filter; import com.ctrip.framework.apollo.adminservice.controller.AbstractControllerTest; import com.ctrip.framework.apollo.common.config.RefreshablePropertySource; import com.ctrip.framework.apollo.common.dto.AppDTO; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.client.HttpClientErrorException; @DirtiesContext public class AdminServiceAuthenticationIntegrationTest extends AbstractControllerTest { @Autowired private List<RefreshablePropertySource> propertySources; @Before public void setUp() throws Exception { doRefresh(propertySources); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-disabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlDisabledExplicitly() { String appId = "someAppId"; AppDTO app = restTemplate .getForObject("http://localhost:" + port + "/apps/" + appId, AppDTO.class); Assert.assertEquals("someAppId", app.getAppId()); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-disabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlDisabledExplicitlyWithAccessToken() { String appId = "someAppId"; String someToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithValidAccessToken() { String appId = "someAppId"; String someValidToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someValidToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } @Test(expected = HttpClientErrorException.class) @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithNoAccessToken() { String appId = "someAppId"; AppDTO app = restTemplate .getForObject("http://localhost:" + port + "/apps/" + appId, AppDTO.class); } @Test(expected = HttpClientErrorException.class) @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithInValidAccessToken() { String appId = "someAppId"; String someValidToken = "someInvalidToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someValidToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); } @Test @Sql(scripts = "/controller/test-release.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/filter/test-access-control-enabled-no-token.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testWithAccessControlEnabledWithNoTokenSpecified() { String appId = "someAppId"; String someToken = "someToken"; HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.AUTHORIZATION, someToken); HttpEntity<Void> entity = new HttpEntity<>(headers); AppDTO app = restTemplate .exchange("http://localhost:" + port + "/apps/" + appId, HttpMethod.GET, entity, AppDTO.class).getBody(); Assert.assertEquals("someAppId", app.getAppId()); } private void doRefresh(List<RefreshablePropertySource> propertySources) { propertySources.forEach(refreshablePropertySource -> ReflectionTestUtils .invokeMethod(refreshablePropertySource, "refresh")); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-admin-server-dev.yaml
# # Copyright 2021 Apollo 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 # # http://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. # --- # configmap for apollo-admin-server-dev kind: ConfigMap apiVersion: v1 metadata: namespace: sre name: configmap-apollo-admin-server-dev data: application-github.properties: | spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8 spring.datasource.username = FillInCorrectUser spring.datasource.password = FillInCorrectPassword eureka.service.url = http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/ --- kind: Service apiVersion: v1 metadata: namespace: sre name: service-apollo-admin-server-dev labels: app: service-apollo-admin-server-dev spec: ports: - protocol: TCP port: 8090 targetPort: 8090 selector: app: pod-apollo-admin-server-dev type: ClusterIP sessionAffinity: ClientIP --- kind: Deployment apiVersion: apps/v1 metadata: namespace: sre name: deployment-apollo-admin-server-dev labels: app: deployment-apollo-admin-server-dev spec: replicas: 3 selector: matchLabels: app: pod-apollo-admin-server-dev strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: pod-apollo-admin-server-dev spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - pod-apollo-admin-server-dev topologyKey: kubernetes.io/hostname volumes: - name: volume-configmap-apollo-admin-server-dev configMap: name: configmap-apollo-admin-server-dev items: - key: application-github.properties path: application-github.properties initContainers: - image: alpine-bash:3.8 name: check-service-apollo-config-server-dev command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-dev.sre:8080"] containers: - image: apollo-admin-server:v1.0.0 securityContext: privileged: true imagePullPolicy: IfNotPresent name: container-apollo-admin-server-dev ports: - protocol: TCP containerPort: 8090 volumeMounts: - name: volume-configmap-apollo-admin-server-dev mountPath: /apollo-admin-server/config/application-github.properties subPath: application-github.properties env: - name: APOLLO_ADMIN_SERVICE_NAME value: "service-apollo-admin-server-dev.sre" readinessProbe: tcpSocket: port: 8090 initialDelaySeconds: 10 periodSeconds: 5 livenessProbe: tcpSocket: port: 8090 initialDelaySeconds: 120 periodSeconds: 10 dnsPolicy: ClusterFirst restartPolicy: Always
# # Copyright 2021 Apollo 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 # # http://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. # --- # configmap for apollo-admin-server-dev kind: ConfigMap apiVersion: v1 metadata: namespace: sre name: configmap-apollo-admin-server-dev data: application-github.properties: | spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8 spring.datasource.username = FillInCorrectUser spring.datasource.password = FillInCorrectPassword eureka.service.url = http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/ --- kind: Service apiVersion: v1 metadata: namespace: sre name: service-apollo-admin-server-dev labels: app: service-apollo-admin-server-dev spec: ports: - protocol: TCP port: 8090 targetPort: 8090 selector: app: pod-apollo-admin-server-dev type: ClusterIP sessionAffinity: ClientIP --- kind: Deployment apiVersion: apps/v1 metadata: namespace: sre name: deployment-apollo-admin-server-dev labels: app: deployment-apollo-admin-server-dev spec: replicas: 3 selector: matchLabels: app: pod-apollo-admin-server-dev strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: pod-apollo-admin-server-dev spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - pod-apollo-admin-server-dev topologyKey: kubernetes.io/hostname volumes: - name: volume-configmap-apollo-admin-server-dev configMap: name: configmap-apollo-admin-server-dev items: - key: application-github.properties path: application-github.properties initContainers: - image: alpine-bash:3.8 name: check-service-apollo-config-server-dev command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-dev.sre:8080"] containers: - image: apollo-admin-server:v1.0.0 securityContext: privileged: true imagePullPolicy: IfNotPresent name: container-apollo-admin-server-dev ports: - protocol: TCP containerPort: 8090 volumeMounts: - name: volume-configmap-apollo-admin-server-dev mountPath: /apollo-admin-server/config/application-github.properties subPath: application-github.properties env: - name: APOLLO_ADMIN_SERVICE_NAME value: "service-apollo-admin-server-dev.sre" readinessProbe: tcpSocket: port: 8090 initialDelaySeconds: 10 periodSeconds: 5 livenessProbe: tcpSocket: port: 8090 initialDelaySeconds: 120 periodSeconds: 10 dnsPolicy: ClusterFirst restartPolicy: Always
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ApolloConfigNotification.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.core.dto; /** * @author Jason Song([email protected]) */ public class ApolloConfigNotification { private String namespaceName; private long notificationId; private volatile ApolloNotificationMessages messages; //for json converter public ApolloConfigNotification() { } public ApolloConfigNotification(String namespaceName, long notificationId) { this.namespaceName = namespaceName; this.notificationId = notificationId; } public String getNamespaceName() { return namespaceName; } public long getNotificationId() { return notificationId; } public void setNamespaceName(String namespaceName) { this.namespaceName = namespaceName; } public ApolloNotificationMessages getMessages() { return messages; } public void setMessages(ApolloNotificationMessages messages) { this.messages = messages; } public void addMessage(String key, long notificationId) { if (this.messages == null) { synchronized (this) { if (this.messages == null) { this.messages = new ApolloNotificationMessages(); } } } this.messages.put(key, notificationId); } @Override public String toString() { return "ApolloConfigNotification{" + "namespaceName='" + namespaceName + '\'' + ", notificationId=" + notificationId + '}'; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.core.dto; /** * @author Jason Song([email protected]) */ public class ApolloConfigNotification { private String namespaceName; private long notificationId; private volatile ApolloNotificationMessages messages; //for json converter public ApolloConfigNotification() { } public ApolloConfigNotification(String namespaceName, long notificationId) { this.namespaceName = namespaceName; this.notificationId = notificationId; } public String getNamespaceName() { return namespaceName; } public long getNotificationId() { return notificationId; } public void setNamespaceName(String namespaceName) { this.namespaceName = namespaceName; } public ApolloNotificationMessages getMessages() { return messages; } public void setMessages(ApolloNotificationMessages messages) { this.messages = messages; } public void addMessage(String key, long notificationId) { if (this.messages == null) { synchronized (this) { if (this.messages == null) { this.messages = new ApolloNotificationMessages(); } } } this.messages.put(key, notificationId); } @Override public String toString() { return "ApolloConfigNotification{" + "namespaceName='" + namespaceName + '\'' + ", notificationId=" + notificationId + '}'; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-openapi/src/main/java/com/ctrip/framework/apollo/openapi/client/constant/ApolloOpenApiConstants.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.openapi.client.constant; public interface ApolloOpenApiConstants { int DEFAULT_CONNECT_TIMEOUT = 1000; //1 second int DEFAULT_READ_TIMEOUT = 5000; //5 seconds String OPEN_API_V1_PREFIX = "/openapi/v1"; String JSON_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.openapi.client.constant; public interface ApolloOpenApiConstants { int DEFAULT_CONNECT_TIMEOUT = 1000; //1 second int DEFAULT_READ_TIMEOUT = 5000; //5 seconds String OPEN_API_V1_PREFIX = "/openapi/v1"; String JSON_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.repository.UserRepository; import com.ctrip.framework.apollo.portal.spi.LogoutHandler; import com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripLogoutHandler; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripSsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserService; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultLogoutHandler; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultSsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultUserService; import com.ctrip.framework.apollo.portal.spi.ldap.ApolloLdapAuthenticationProvider; import com.ctrip.framework.apollo.portal.spi.ldap.FilterLdapByGroupUserSearch; import com.ctrip.framework.apollo.portal.spi.ldap.LdapUserService; import com.ctrip.framework.apollo.portal.spi.oidc.ExcludeClientCredentialsClientRegistrationRepository; import com.ctrip.framework.apollo.portal.spi.oidc.OidcAuthenticationSuccessEventListener; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserService; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserServiceImpl; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLogoutHandler; import com.ctrip.framework.apollo.portal.spi.oidc.OidcUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.springsecurity.SpringSecurityUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.springsecurity.SpringSecurityUserService; import com.google.common.collect.Maps; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.ldap.core.ContextSource; import org.springframework.ldap.core.LdapOperations; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.support.LdapContextSource; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.ldap.authentication.BindAuthenticator; import org.springframework.security.ldap.authentication.LdapAuthenticationProvider; import org.springframework.security.ldap.search.FilterBasedLdapUserSearch; import org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator; import org.springframework.security.oauth2.client.oidc.web.logout.OidcClientInitiatedLogoutSuccessHandler; import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository; import org.springframework.security.provisioning.JdbcUserDetailsManager; import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; import javax.servlet.Filter; import javax.sql.DataSource; import java.util.Collections; import java.util.EventListener; import java.util.Map; @Configuration public class AuthConfiguration { private static final String[] BY_PASS_URLS = {"/prometheus/**", "/metrics/**", "/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**", "/prefix-path", "/health"}; /** * spring.profiles.active = ctrip */ @Configuration @Profile("ctrip") static class CtripAuthAutoConfiguration { private final PortalConfig portalConfig; public CtripAuthAutoConfiguration(final PortalConfig portalConfig) { this.portalConfig = portalConfig; } @Bean public ServletListenerRegistrationBean redisAppSettingListner() { ServletListenerRegistrationBean redisAppSettingListener = new ServletListenerRegistrationBean(); redisAppSettingListener .setListener(listener("org.jasig.cas.client.credis.CRedisAppSettingListner")); return redisAppSettingListener; } @Bean public ServletListenerRegistrationBean singleSignOutHttpSessionListener() { ServletListenerRegistrationBean singleSignOutHttpSessionListener = new ServletListenerRegistrationBean(); singleSignOutHttpSessionListener .setListener(listener("org.jasig.cas.client.session.SingleSignOutHttpSessionListener")); return singleSignOutHttpSessionListener; } @Bean public FilterRegistrationBean casFilter() { FilterRegistrationBean singleSignOutFilter = new FilterRegistrationBean(); singleSignOutFilter.setFilter(filter("org.jasig.cas.client.session.SingleSignOutFilter")); singleSignOutFilter.addUrlPatterns("/*"); singleSignOutFilter.setOrder(1); return singleSignOutFilter; } @Bean public FilterRegistrationBean authenticationFilter() { FilterRegistrationBean casFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("redisClusterName", "casClientPrincipal"); filterInitParam.put("serverName", portalConfig.portalServerName()); filterInitParam.put("casServerLoginUrl", portalConfig.casServerLoginUrl()); //we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance filterInitParam.put("useSession", "false"); filterInitParam.put("/openapi.*", "exclude"); casFilter.setInitParameters(filterInitParam); casFilter .setFilter(filter("com.ctrip.framework.apollo.sso.filter.ApolloAuthenticationFilter")); casFilter.addUrlPatterns("/*"); casFilter.setOrder(2); return casFilter; } @Bean public FilterRegistrationBean casValidationFilter() { FilterRegistrationBean casValidationFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("casServerUrlPrefix", portalConfig.casServerUrlPrefix()); filterInitParam.put("serverName", portalConfig.portalServerName()); filterInitParam.put("encoding", "UTF-8"); //we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance filterInitParam.put("useSession", "false"); filterInitParam.put("useRedis", "true"); filterInitParam.put("redisClusterName", "casClientPrincipal"); casValidationFilter .setFilter( filter("org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter")); casValidationFilter.setInitParameters(filterInitParam); casValidationFilter.addUrlPatterns("/*"); casValidationFilter.setOrder(3); return casValidationFilter; } @Bean public FilterRegistrationBean assertionHolder() { FilterRegistrationBean assertionHolderFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("/openapi.*", "exclude"); assertionHolderFilter.setInitParameters(filterInitParam); assertionHolderFilter.setFilter( filter("com.ctrip.framework.apollo.sso.filter.ApolloAssertionThreadLocalFilter")); assertionHolderFilter.addUrlPatterns("/*"); assertionHolderFilter.setOrder(4); return assertionHolderFilter; } @Bean public CtripUserInfoHolder ctripUserInfoHolder() { return new CtripUserInfoHolder(); } @Bean public CtripLogoutHandler logoutHandler() { return new CtripLogoutHandler(); } private Filter filter(String className) { Class clazz = null; try { clazz = Class.forName(className); Object obj = clazz.newInstance(); return (Filter) obj; } catch (Exception e) { throw new RuntimeException("instance filter fail", e); } } private EventListener listener(String className) { Class clazz = null; try { clazz = Class.forName(className); Object obj = clazz.newInstance(); return (EventListener) obj; } catch (Exception e) { throw new RuntimeException("instance listener fail", e); } } @Bean public UserService ctripUserService(PortalConfig portalConfig) { return new CtripUserService(portalConfig); } @Bean public SsoHeartbeatHandler ctripSsoHeartbeatHandler() { return new CtripSsoHeartbeatHandler(); } } /** * spring.profiles.active = auth */ @Configuration @Profile("auth") static class SpringSecurityAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder springSecurityUserInfoHolder(UserService userService) { return new SpringSecurityUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean public JdbcUserDetailsManager jdbcUserDetailsManager(AuthenticationManagerBuilder auth, DataSource datasource) throws Exception { JdbcUserDetailsManager jdbcUserDetailsManager = auth.jdbcAuthentication() .passwordEncoder(new BCryptPasswordEncoder()).dataSource(datasource) .usersByUsernameQuery("select Username,Password,Enabled from `Users` where Username = ?") .authoritiesByUsernameQuery( "select Username,Authority from `Authorities` where Username = ?") .getUserDetailsService(); jdbcUserDetailsManager.setUserExistsSql("select Username from `Users` where Username = ?"); jdbcUserDetailsManager .setCreateUserSql("insert into `Users` (Username, Password, Enabled) values (?,?,?)"); jdbcUserDetailsManager .setUpdateUserSql("update `Users` set Password = ?, Enabled = ? where id = (select u.id from (select id from `Users` where Username = ?) as u)"); jdbcUserDetailsManager.setDeleteUserSql("delete from `Users` where id = (select u.id from (select id from `Users` where Username = ?) as u)"); jdbcUserDetailsManager .setCreateAuthoritySql("insert into `Authorities` (Username, Authority) values (?,?)"); jdbcUserDetailsManager .setDeleteUserAuthoritiesSql("delete from `Authorities` where id in (select a.id from (select id from `Authorities` where Username = ?) as a)"); jdbcUserDetailsManager .setChangePasswordSql("update `Users` set Password = ? where id = (select u.id from (select id from `Users` where Username = ?) as u)"); return jdbcUserDetailsManager; } @Bean @ConditionalOnMissingBean(UserService.class) public UserService springSecurityUserService() { return new SpringSecurityUserService(); } } @Order(99) @Profile("auth") @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class SpringSecurityConfigurer extends WebSecurityConfigurerAdapter { public static final String USER_ROLE = "user"; @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers(BY_PASS_URLS).permitAll() .antMatchers("/**").hasAnyRole(USER_ROLE); http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() .httpBasic(); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessUrl("/signin?#/logout"); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); } } /** * spring.profiles.active = ldap */ @Configuration @Profile("ldap") @EnableConfigurationProperties({LdapProperties.class,LdapExtendProperties.class}) static class SpringSecurityLDAPAuthAutoConfiguration { private final LdapProperties properties; private final Environment environment; public SpringSecurityLDAPAuthAutoConfiguration(final LdapProperties properties, final Environment environment) { this.properties = properties; this.environment = environment; } @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder springSecurityUserInfoHolder(UserService userService) { return new SpringSecurityUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean @ConditionalOnMissingBean(UserService.class) public UserService springSecurityUserService() { return new LdapUserService(); } @Bean @ConditionalOnMissingBean public ContextSource ldapContextSource() { LdapContextSource source = new LdapContextSource(); source.setUserDn(this.properties.getUsername()); source.setPassword(this.properties.getPassword()); source.setAnonymousReadOnly(this.properties.getAnonymousReadOnly()); source.setBase(this.properties.getBase()); source.setUrls(this.properties.determineUrls(this.environment)); source.setBaseEnvironmentProperties( Collections.unmodifiableMap(this.properties.getBaseEnvironment())); return source; } @Bean @ConditionalOnMissingBean(LdapOperations.class) public LdapTemplate ldapTemplate(ContextSource contextSource) { LdapTemplate ldapTemplate = new LdapTemplate(contextSource); ldapTemplate.setIgnorePartialResultException(true); return ldapTemplate; } } @Order(99) @Profile("ldap") @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class SpringSecurityLDAPConfigurer extends WebSecurityConfigurerAdapter { private final LdapProperties ldapProperties; private final LdapContextSource ldapContextSource; private final LdapExtendProperties ldapExtendProperties; public SpringSecurityLDAPConfigurer(final LdapProperties ldapProperties, final LdapContextSource ldapContextSource, final LdapExtendProperties ldapExtendProperties) { this.ldapProperties = ldapProperties; this.ldapContextSource = ldapContextSource; this.ldapExtendProperties = ldapExtendProperties; } @Bean public FilterBasedLdapUserSearch userSearch() { if (ldapExtendProperties.getGroup() == null || StringUtils .isBlank(ldapExtendProperties.getGroup().getGroupSearch())) { FilterBasedLdapUserSearch filterBasedLdapUserSearch = new FilterBasedLdapUserSearch("", ldapProperties.getSearchFilter(), ldapContextSource); filterBasedLdapUserSearch.setSearchSubtree(true); return filterBasedLdapUserSearch; } FilterLdapByGroupUserSearch filterLdapByGroupUserSearch = new FilterLdapByGroupUserSearch( ldapProperties.getBase(), ldapProperties.getSearchFilter(), ldapExtendProperties.getGroup().getGroupBase(), ldapContextSource, ldapExtendProperties.getGroup().getGroupSearch(), ldapExtendProperties.getMapping().getRdnKey(), ldapExtendProperties.getGroup().getGroupMembership(),ldapExtendProperties.getMapping().getLoginId()); filterLdapByGroupUserSearch.setSearchSubtree(true); return filterLdapByGroupUserSearch; } @Bean public LdapAuthenticationProvider ldapAuthProvider() { BindAuthenticator bindAuthenticator = new BindAuthenticator(ldapContextSource); bindAuthenticator.setUserSearch(userSearch()); DefaultLdapAuthoritiesPopulator defaultAuthAutoConfiguration = new DefaultLdapAuthoritiesPopulator( ldapContextSource, null); defaultAuthAutoConfiguration.setIgnorePartialResultException(true); defaultAuthAutoConfiguration.setSearchSubtree(true); // Rewrite the logic of LdapAuthenticationProvider with ApolloLdapAuthenticationProvider, // use userId in LDAP system instead of userId input by user. return new ApolloLdapAuthenticationProvider( bindAuthenticator, defaultAuthAutoConfiguration, ldapExtendProperties); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers(BY_PASS_URLS).permitAll() .antMatchers("/**").authenticated(); http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() .httpBasic(); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessUrl("/signin?#/logout"); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(ldapAuthProvider()); } } @Profile("oidc") @EnableConfigurationProperties({OAuth2ClientProperties.class, OAuth2ResourceServerProperties.class}) @Configuration static class OidcAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder oidcUserInfoHolder(UserService userService) { return new OidcUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler oidcLogoutHandler() { return new OidcLogoutHandler(); } @Bean @ConditionalOnMissingBean(JdbcUserDetailsManager.class) public JdbcUserDetailsManager jdbcUserDetailsManager(AuthenticationManagerBuilder auth, DataSource datasource) throws Exception { return new SpringSecurityAuthAutoConfiguration().jdbcUserDetailsManager(auth, datasource); } @Bean @ConditionalOnMissingBean(UserService.class) public OidcLocalUserService oidcLocalUserService(JdbcUserDetailsManager userDetailsManager, UserRepository userRepository) { return new OidcLocalUserServiceImpl(userDetailsManager, userRepository); } @Bean public OidcAuthenticationSuccessEventListener oidcAuthenticationSuccessEventListener(OidcLocalUserService oidcLocalUserService) { return new OidcAuthenticationSuccessEventListener(oidcLocalUserService); } } @Profile("oidc") @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @Configuration static class OidcWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { private final InMemoryClientRegistrationRepository clientRegistrationRepository; private final OAuth2ResourceServerProperties oauth2ResourceServerProperties; public OidcWebSecurityConfigurerAdapter( InMemoryClientRegistrationRepository clientRegistrationRepository, OAuth2ResourceServerProperties oauth2ResourceServerProperties) { this.clientRegistrationRepository = clientRegistrationRepository; this.oauth2ResourceServerProperties = oauth2ResourceServerProperties; } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.authorizeRequests(requests -> requests.antMatchers(BY_PASS_URLS).permitAll()); http.authorizeRequests(requests -> requests.anyRequest().authenticated()); http.oauth2Login(configure -> configure.clientRegistrationRepository( new ExcludeClientCredentialsClientRegistrationRepository( this.clientRegistrationRepository))); http.oauth2Client(); http.logout(configure -> { OidcClientInitiatedLogoutSuccessHandler logoutSuccessHandler = new OidcClientInitiatedLogoutSuccessHandler( this.clientRegistrationRepository); logoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}"); configure.logoutSuccessHandler(logoutSuccessHandler); }); // make jwt optional String jwtIssuerUri = this.oauth2ResourceServerProperties.getJwt().getIssuerUri(); if (!StringUtils.isBlank(jwtIssuerUri)) { http.oauth2ResourceServer().jwt(); } } } /** * default profile */ @Configuration @ConditionalOnMissingProfile({"ctrip", "auth", "ldap", "oidc"}) static class DefaultAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public DefaultUserInfoHolder defaultUserInfoHolder() { return new DefaultUserInfoHolder(); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public DefaultLogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean @ConditionalOnMissingBean(UserService.class) public UserService defaultUserService() { return new DefaultUserService(); } } @ConditionalOnMissingProfile({"auth", "ldap", "oidc"}) @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class DefaultWebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.repository.UserRepository; import com.ctrip.framework.apollo.portal.spi.LogoutHandler; import com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripLogoutHandler; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripSsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserService; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultLogoutHandler; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultSsoHeartbeatHandler; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.defaultimpl.DefaultUserService; import com.ctrip.framework.apollo.portal.spi.ldap.ApolloLdapAuthenticationProvider; import com.ctrip.framework.apollo.portal.spi.ldap.FilterLdapByGroupUserSearch; import com.ctrip.framework.apollo.portal.spi.ldap.LdapUserService; import com.ctrip.framework.apollo.portal.spi.oidc.ExcludeClientCredentialsClientRegistrationRepository; import com.ctrip.framework.apollo.portal.spi.oidc.OidcAuthenticationSuccessEventListener; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserService; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLocalUserServiceImpl; import com.ctrip.framework.apollo.portal.spi.oidc.OidcLogoutHandler; import com.ctrip.framework.apollo.portal.spi.oidc.OidcUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.springsecurity.SpringSecurityUserInfoHolder; import com.ctrip.framework.apollo.portal.spi.springsecurity.SpringSecurityUserService; import com.google.common.collect.Maps; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.ldap.core.ContextSource; import org.springframework.ldap.core.LdapOperations; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.support.LdapContextSource; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.ldap.authentication.BindAuthenticator; import org.springframework.security.ldap.authentication.LdapAuthenticationProvider; import org.springframework.security.ldap.search.FilterBasedLdapUserSearch; import org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator; import org.springframework.security.oauth2.client.oidc.web.logout.OidcClientInitiatedLogoutSuccessHandler; import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository; import org.springframework.security.provisioning.JdbcUserDetailsManager; import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; import javax.servlet.Filter; import javax.sql.DataSource; import java.util.Collections; import java.util.EventListener; import java.util.Map; @Configuration public class AuthConfiguration { private static final String[] BY_PASS_URLS = {"/prometheus/**", "/metrics/**", "/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**", "/prefix-path", "/health"}; /** * spring.profiles.active = ctrip */ @Configuration @Profile("ctrip") static class CtripAuthAutoConfiguration { private final PortalConfig portalConfig; public CtripAuthAutoConfiguration(final PortalConfig portalConfig) { this.portalConfig = portalConfig; } @Bean public ServletListenerRegistrationBean redisAppSettingListner() { ServletListenerRegistrationBean redisAppSettingListener = new ServletListenerRegistrationBean(); redisAppSettingListener .setListener(listener("org.jasig.cas.client.credis.CRedisAppSettingListner")); return redisAppSettingListener; } @Bean public ServletListenerRegistrationBean singleSignOutHttpSessionListener() { ServletListenerRegistrationBean singleSignOutHttpSessionListener = new ServletListenerRegistrationBean(); singleSignOutHttpSessionListener .setListener(listener("org.jasig.cas.client.session.SingleSignOutHttpSessionListener")); return singleSignOutHttpSessionListener; } @Bean public FilterRegistrationBean casFilter() { FilterRegistrationBean singleSignOutFilter = new FilterRegistrationBean(); singleSignOutFilter.setFilter(filter("org.jasig.cas.client.session.SingleSignOutFilter")); singleSignOutFilter.addUrlPatterns("/*"); singleSignOutFilter.setOrder(1); return singleSignOutFilter; } @Bean public FilterRegistrationBean authenticationFilter() { FilterRegistrationBean casFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("redisClusterName", "casClientPrincipal"); filterInitParam.put("serverName", portalConfig.portalServerName()); filterInitParam.put("casServerLoginUrl", portalConfig.casServerLoginUrl()); //we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance filterInitParam.put("useSession", "false"); filterInitParam.put("/openapi.*", "exclude"); casFilter.setInitParameters(filterInitParam); casFilter .setFilter(filter("com.ctrip.framework.apollo.sso.filter.ApolloAuthenticationFilter")); casFilter.addUrlPatterns("/*"); casFilter.setOrder(2); return casFilter; } @Bean public FilterRegistrationBean casValidationFilter() { FilterRegistrationBean casValidationFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("casServerUrlPrefix", portalConfig.casServerUrlPrefix()); filterInitParam.put("serverName", portalConfig.portalServerName()); filterInitParam.put("encoding", "UTF-8"); //we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance filterInitParam.put("useSession", "false"); filterInitParam.put("useRedis", "true"); filterInitParam.put("redisClusterName", "casClientPrincipal"); casValidationFilter .setFilter( filter("org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter")); casValidationFilter.setInitParameters(filterInitParam); casValidationFilter.addUrlPatterns("/*"); casValidationFilter.setOrder(3); return casValidationFilter; } @Bean public FilterRegistrationBean assertionHolder() { FilterRegistrationBean assertionHolderFilter = new FilterRegistrationBean(); Map<String, String> filterInitParam = Maps.newHashMap(); filterInitParam.put("/openapi.*", "exclude"); assertionHolderFilter.setInitParameters(filterInitParam); assertionHolderFilter.setFilter( filter("com.ctrip.framework.apollo.sso.filter.ApolloAssertionThreadLocalFilter")); assertionHolderFilter.addUrlPatterns("/*"); assertionHolderFilter.setOrder(4); return assertionHolderFilter; } @Bean public CtripUserInfoHolder ctripUserInfoHolder() { return new CtripUserInfoHolder(); } @Bean public CtripLogoutHandler logoutHandler() { return new CtripLogoutHandler(); } private Filter filter(String className) { Class clazz = null; try { clazz = Class.forName(className); Object obj = clazz.newInstance(); return (Filter) obj; } catch (Exception e) { throw new RuntimeException("instance filter fail", e); } } private EventListener listener(String className) { Class clazz = null; try { clazz = Class.forName(className); Object obj = clazz.newInstance(); return (EventListener) obj; } catch (Exception e) { throw new RuntimeException("instance listener fail", e); } } @Bean public UserService ctripUserService(PortalConfig portalConfig) { return new CtripUserService(portalConfig); } @Bean public SsoHeartbeatHandler ctripSsoHeartbeatHandler() { return new CtripSsoHeartbeatHandler(); } } /** * spring.profiles.active = auth */ @Configuration @Profile("auth") static class SpringSecurityAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder springSecurityUserInfoHolder(UserService userService) { return new SpringSecurityUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean public JdbcUserDetailsManager jdbcUserDetailsManager(AuthenticationManagerBuilder auth, DataSource datasource) throws Exception { JdbcUserDetailsManager jdbcUserDetailsManager = auth.jdbcAuthentication() .passwordEncoder(new BCryptPasswordEncoder()).dataSource(datasource) .usersByUsernameQuery("select Username,Password,Enabled from `Users` where Username = ?") .authoritiesByUsernameQuery( "select Username,Authority from `Authorities` where Username = ?") .getUserDetailsService(); jdbcUserDetailsManager.setUserExistsSql("select Username from `Users` where Username = ?"); jdbcUserDetailsManager .setCreateUserSql("insert into `Users` (Username, Password, Enabled) values (?,?,?)"); jdbcUserDetailsManager .setUpdateUserSql("update `Users` set Password = ?, Enabled = ? where id = (select u.id from (select id from `Users` where Username = ?) as u)"); jdbcUserDetailsManager.setDeleteUserSql("delete from `Users` where id = (select u.id from (select id from `Users` where Username = ?) as u)"); jdbcUserDetailsManager .setCreateAuthoritySql("insert into `Authorities` (Username, Authority) values (?,?)"); jdbcUserDetailsManager .setDeleteUserAuthoritiesSql("delete from `Authorities` where id in (select a.id from (select id from `Authorities` where Username = ?) as a)"); jdbcUserDetailsManager .setChangePasswordSql("update `Users` set Password = ? where id = (select u.id from (select id from `Users` where Username = ?) as u)"); return jdbcUserDetailsManager; } @Bean @ConditionalOnMissingBean(UserService.class) public UserService springSecurityUserService() { return new SpringSecurityUserService(); } } @Order(99) @Profile("auth") @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class SpringSecurityConfigurer extends WebSecurityConfigurerAdapter { public static final String USER_ROLE = "user"; @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers(BY_PASS_URLS).permitAll() .antMatchers("/**").hasAnyRole(USER_ROLE); http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() .httpBasic(); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessUrl("/signin?#/logout"); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); } } /** * spring.profiles.active = ldap */ @Configuration @Profile("ldap") @EnableConfigurationProperties({LdapProperties.class,LdapExtendProperties.class}) static class SpringSecurityLDAPAuthAutoConfiguration { private final LdapProperties properties; private final Environment environment; public SpringSecurityLDAPAuthAutoConfiguration(final LdapProperties properties, final Environment environment) { this.properties = properties; this.environment = environment; } @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder springSecurityUserInfoHolder(UserService userService) { return new SpringSecurityUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean @ConditionalOnMissingBean(UserService.class) public UserService springSecurityUserService() { return new LdapUserService(); } @Bean @ConditionalOnMissingBean public ContextSource ldapContextSource() { LdapContextSource source = new LdapContextSource(); source.setUserDn(this.properties.getUsername()); source.setPassword(this.properties.getPassword()); source.setAnonymousReadOnly(this.properties.getAnonymousReadOnly()); source.setBase(this.properties.getBase()); source.setUrls(this.properties.determineUrls(this.environment)); source.setBaseEnvironmentProperties( Collections.unmodifiableMap(this.properties.getBaseEnvironment())); return source; } @Bean @ConditionalOnMissingBean(LdapOperations.class) public LdapTemplate ldapTemplate(ContextSource contextSource) { LdapTemplate ldapTemplate = new LdapTemplate(contextSource); ldapTemplate.setIgnorePartialResultException(true); return ldapTemplate; } } @Order(99) @Profile("ldap") @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class SpringSecurityLDAPConfigurer extends WebSecurityConfigurerAdapter { private final LdapProperties ldapProperties; private final LdapContextSource ldapContextSource; private final LdapExtendProperties ldapExtendProperties; public SpringSecurityLDAPConfigurer(final LdapProperties ldapProperties, final LdapContextSource ldapContextSource, final LdapExtendProperties ldapExtendProperties) { this.ldapProperties = ldapProperties; this.ldapContextSource = ldapContextSource; this.ldapExtendProperties = ldapExtendProperties; } @Bean public FilterBasedLdapUserSearch userSearch() { if (ldapExtendProperties.getGroup() == null || StringUtils .isBlank(ldapExtendProperties.getGroup().getGroupSearch())) { FilterBasedLdapUserSearch filterBasedLdapUserSearch = new FilterBasedLdapUserSearch("", ldapProperties.getSearchFilter(), ldapContextSource); filterBasedLdapUserSearch.setSearchSubtree(true); return filterBasedLdapUserSearch; } FilterLdapByGroupUserSearch filterLdapByGroupUserSearch = new FilterLdapByGroupUserSearch( ldapProperties.getBase(), ldapProperties.getSearchFilter(), ldapExtendProperties.getGroup().getGroupBase(), ldapContextSource, ldapExtendProperties.getGroup().getGroupSearch(), ldapExtendProperties.getMapping().getRdnKey(), ldapExtendProperties.getGroup().getGroupMembership(),ldapExtendProperties.getMapping().getLoginId()); filterLdapByGroupUserSearch.setSearchSubtree(true); return filterLdapByGroupUserSearch; } @Bean public LdapAuthenticationProvider ldapAuthProvider() { BindAuthenticator bindAuthenticator = new BindAuthenticator(ldapContextSource); bindAuthenticator.setUserSearch(userSearch()); DefaultLdapAuthoritiesPopulator defaultAuthAutoConfiguration = new DefaultLdapAuthoritiesPopulator( ldapContextSource, null); defaultAuthAutoConfiguration.setIgnorePartialResultException(true); defaultAuthAutoConfiguration.setSearchSubtree(true); // Rewrite the logic of LdapAuthenticationProvider with ApolloLdapAuthenticationProvider, // use userId in LDAP system instead of userId input by user. return new ApolloLdapAuthenticationProvider( bindAuthenticator, defaultAuthAutoConfiguration, ldapExtendProperties); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); http.authorizeRequests() .antMatchers(BY_PASS_URLS).permitAll() .antMatchers("/**").authenticated(); http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() .httpBasic(); http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) .logoutSuccessUrl("/signin?#/logout"); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(ldapAuthProvider()); } } @Profile("oidc") @EnableConfigurationProperties({OAuth2ClientProperties.class, OAuth2ResourceServerProperties.class}) @Configuration static class OidcAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public UserInfoHolder oidcUserInfoHolder(UserService userService) { return new OidcUserInfoHolder(userService); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public LogoutHandler oidcLogoutHandler() { return new OidcLogoutHandler(); } @Bean @ConditionalOnMissingBean(JdbcUserDetailsManager.class) public JdbcUserDetailsManager jdbcUserDetailsManager(AuthenticationManagerBuilder auth, DataSource datasource) throws Exception { return new SpringSecurityAuthAutoConfiguration().jdbcUserDetailsManager(auth, datasource); } @Bean @ConditionalOnMissingBean(UserService.class) public OidcLocalUserService oidcLocalUserService(JdbcUserDetailsManager userDetailsManager, UserRepository userRepository) { return new OidcLocalUserServiceImpl(userDetailsManager, userRepository); } @Bean public OidcAuthenticationSuccessEventListener oidcAuthenticationSuccessEventListener(OidcLocalUserService oidcLocalUserService) { return new OidcAuthenticationSuccessEventListener(oidcLocalUserService); } } @Profile("oidc") @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @Configuration static class OidcWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { private final InMemoryClientRegistrationRepository clientRegistrationRepository; private final OAuth2ResourceServerProperties oauth2ResourceServerProperties; public OidcWebSecurityConfigurerAdapter( InMemoryClientRegistrationRepository clientRegistrationRepository, OAuth2ResourceServerProperties oauth2ResourceServerProperties) { this.clientRegistrationRepository = clientRegistrationRepository; this.oauth2ResourceServerProperties = oauth2ResourceServerProperties; } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.authorizeRequests(requests -> requests.antMatchers(BY_PASS_URLS).permitAll()); http.authorizeRequests(requests -> requests.anyRequest().authenticated()); http.oauth2Login(configure -> configure.clientRegistrationRepository( new ExcludeClientCredentialsClientRegistrationRepository( this.clientRegistrationRepository))); http.oauth2Client(); http.logout(configure -> { OidcClientInitiatedLogoutSuccessHandler logoutSuccessHandler = new OidcClientInitiatedLogoutSuccessHandler( this.clientRegistrationRepository); logoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}"); configure.logoutSuccessHandler(logoutSuccessHandler); }); // make jwt optional String jwtIssuerUri = this.oauth2ResourceServerProperties.getJwt().getIssuerUri(); if (!StringUtils.isBlank(jwtIssuerUri)) { http.oauth2ResourceServer().jwt(); } } } /** * default profile */ @Configuration @ConditionalOnMissingProfile({"ctrip", "auth", "ldap", "oidc"}) static class DefaultAuthAutoConfiguration { @Bean @ConditionalOnMissingBean(SsoHeartbeatHandler.class) public SsoHeartbeatHandler defaultSsoHeartbeatHandler() { return new DefaultSsoHeartbeatHandler(); } @Bean @ConditionalOnMissingBean(UserInfoHolder.class) public DefaultUserInfoHolder defaultUserInfoHolder() { return new DefaultUserInfoHolder(); } @Bean @ConditionalOnMissingBean(LogoutHandler.class) public DefaultLogoutHandler logoutHandler() { return new DefaultLogoutHandler(); } @Bean @ConditionalOnMissingBean(UserService.class) public UserService defaultUserService() { return new DefaultUserService(); } } @ConditionalOnMissingProfile({"auth", "ldap", "oidc"}) @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class DefaultWebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().sameOrigin(); } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/usage/third-party-sdks-user-guide.md
## 1. Go ### Apollo Go 客户端 1 项目地址:[zouyx/agollo](https://github.com/zouyx/agollo) > 非常感谢[@zouyx](https://github.com/zouyx)提供Go Apollo客户端的支持 ### Apollo Go 客户端 2 项目地址:[philchia/agollo](https://github.com/philchia/agollo) > 非常感谢[@philchia](https://github.com/philchia)提供Go Apollo客户端的支持 ### Apollo Go 客户端 3 项目地址:[shima-park/agollo](https://github.com/shima-park/agollo) > 非常感谢[@shima-park](https://github.com/shima-park)提供Go Apollo客户端的支持 ### Apollo Go 客户端 4 项目地址:[go-microservices/php_conf_agent](https://github.com/go-microservices/php_conf_agent) > 非常感谢[@GanymedeNil](https://github.com/GanymedeNil)提供Go Apollo客户端的支持 ### Apollo Go 客户端 5 项目地址:[hyperjiang/lunar](https://github.com/hyperjiang/lunar) > 非常感谢[@hyperjiang](https://github.com/hyperjiang)提供Go Apollo客户端的支持 ### Apollo Go 客户端 6 项目地址:[tagconfig/tagconfig](https://github.com/tagconfig/tagconfig) > 非常感谢[@n0trace](https://github.com/n0trace)提供Go Apollo客户端的支持 ### Apollo Go 客户端 7 项目地址:[go-chassis/go-archaius](https://github.com/go-chassis/go-archaius/tree/master/examples/apollo) > 非常感谢[@tianxiaoliang](https://github.com/tianxiaoliang) 和 [@Shonminh](https://github.com/Shonminh)提供Go Apollo客户端的支持 ### Apollo Go 客户端 8 项目地址:[xhrg-product/apollo-client-golang](https://github.com/xhrg-product/apollo-client-golang) > 非常感谢[@xhrg](https://github.com/xhrg)提供Go Apollo客户端的支持 ## 2. Python ### Apollo Python 客户端 1 项目地址:[pyapollo](https://github.com/filamoon/pyapollo) > 非常感谢[@filamoon](https://github.com/filamoon)提供Python Apollo客户端的支持 ### Apollo Python 客户端 2 项目地址:[BruceWW-pyapollo](https://github.com/BruceWW/pyapollo) > 非常感谢[@BruceWW](https://github.com/BruceWW)提供Python Apollo客户端的支持 ### Apollo Python 客户端 3 项目地址:[xhrg-product/apollo-client-python](https://github.com/xhrg-product/apollo-client-python) > 非常感谢[@xhrg-product](https://github.com/xhrg-product)提供Python Apollo客户端的支持 ## 3. NodeJS ### Apollo NodeJS 客户端 1 项目地址:[node-apollo](https://github.com/Quinton/node-apollo) > 非常感谢[@Quinton](https://github.com/Quinton)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 2 项目地址:[ctrip-apollo](https://github.com/kaelzhang/ctrip-apollo) > 非常感谢[@kaelzhang](https://github.com/kaelzhang)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 3 项目地址:[node-apollo-client](https://github.com/shinux/node-apollo-client) > 非常感谢[@shinux](https://github.com/shinux)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 4 项目地址:[ctrip-apollo-client](https://github.com/lvgithub/ctrip-apollo-client) > 非常感谢[@lvgithub](https://github.com/lvgithub)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 5 项目地址:[apollo-node](https://github.com/lengyuxuan/apollo-node) > 非常感谢[@lengyuxuan](https://github.com/lengyuxuan)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 6 项目地址:[egg-apollo-client](https://github.com/xuezier/egg-apollo-client) > 非常感谢[@xuezier](https://github.com/xuezier)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 7 项目地址:[apollo-node-client](https://github.com/zhangxh1023/apollo-node-client) > 非常感谢[@zhangxh1023](https://github.com/zhangxh1023)提供NodeJS Apollo客户端的支持 ## 4. PHP ### Apollo PHP 客户端 1 项目地址:[apollo-php-client](https://github.com/multilinguals/apollo-php-client) > 非常感谢[@t04041143](https://github.com/t04041143)提供PHP Apollo客户端的支持 ### Apollo PHP 客户端 2 项目地址:[apollo-sdk-config](https://github.com/fengzhibin/apollo-sdk-config) 项目地址:[apollo-sdk-clientd](https://github.com/fengzhibin/apollo-sdk-clientd) > 非常感谢[@fengzhibin](https://github.com/fengzhibin)提供PHP Apollo客户端的支持 ## 5. C ### Apollo C 客户端 项目地址:[apollo-c-client](https://github.com/lzeqian/apollo) > 非常感谢[@lzeqian](https://github.com/lzeqian)提供C Apollo客户端的支持
## 1. Go ### Apollo Go 客户端 1 项目地址:[zouyx/agollo](https://github.com/zouyx/agollo) > 非常感谢[@zouyx](https://github.com/zouyx)提供Go Apollo客户端的支持 ### Apollo Go 客户端 2 项目地址:[philchia/agollo](https://github.com/philchia/agollo) > 非常感谢[@philchia](https://github.com/philchia)提供Go Apollo客户端的支持 ### Apollo Go 客户端 3 项目地址:[shima-park/agollo](https://github.com/shima-park/agollo) > 非常感谢[@shima-park](https://github.com/shima-park)提供Go Apollo客户端的支持 ### Apollo Go 客户端 4 项目地址:[go-microservices/php_conf_agent](https://github.com/go-microservices/php_conf_agent) > 非常感谢[@GanymedeNil](https://github.com/GanymedeNil)提供Go Apollo客户端的支持 ### Apollo Go 客户端 5 项目地址:[hyperjiang/lunar](https://github.com/hyperjiang/lunar) > 非常感谢[@hyperjiang](https://github.com/hyperjiang)提供Go Apollo客户端的支持 ### Apollo Go 客户端 6 项目地址:[tagconfig/tagconfig](https://github.com/tagconfig/tagconfig) > 非常感谢[@n0trace](https://github.com/n0trace)提供Go Apollo客户端的支持 ### Apollo Go 客户端 7 项目地址:[go-chassis/go-archaius](https://github.com/go-chassis/go-archaius/tree/master/examples/apollo) > 非常感谢[@tianxiaoliang](https://github.com/tianxiaoliang) 和 [@Shonminh](https://github.com/Shonminh)提供Go Apollo客户端的支持 ### Apollo Go 客户端 8 项目地址:[xhrg-product/apollo-client-golang](https://github.com/xhrg-product/apollo-client-golang) > 非常感谢[@xhrg](https://github.com/xhrg)提供Go Apollo客户端的支持 ## 2. Python ### Apollo Python 客户端 1 项目地址:[pyapollo](https://github.com/filamoon/pyapollo) > 非常感谢[@filamoon](https://github.com/filamoon)提供Python Apollo客户端的支持 ### Apollo Python 客户端 2 项目地址:[BruceWW-pyapollo](https://github.com/BruceWW/pyapollo) > 非常感谢[@BruceWW](https://github.com/BruceWW)提供Python Apollo客户端的支持 ### Apollo Python 客户端 3 项目地址:[xhrg-product/apollo-client-python](https://github.com/xhrg-product/apollo-client-python) > 非常感谢[@xhrg-product](https://github.com/xhrg-product)提供Python Apollo客户端的支持 ## 3. NodeJS ### Apollo NodeJS 客户端 1 项目地址:[node-apollo](https://github.com/Quinton/node-apollo) > 非常感谢[@Quinton](https://github.com/Quinton)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 2 项目地址:[ctrip-apollo](https://github.com/kaelzhang/ctrip-apollo) > 非常感谢[@kaelzhang](https://github.com/kaelzhang)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 3 项目地址:[node-apollo-client](https://github.com/shinux/node-apollo-client) > 非常感谢[@shinux](https://github.com/shinux)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 4 项目地址:[ctrip-apollo-client](https://github.com/lvgithub/ctrip-apollo-client) > 非常感谢[@lvgithub](https://github.com/lvgithub)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 5 项目地址:[apollo-node](https://github.com/lengyuxuan/apollo-node) > 非常感谢[@lengyuxuan](https://github.com/lengyuxuan)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 6 项目地址:[egg-apollo-client](https://github.com/xuezier/egg-apollo-client) > 非常感谢[@xuezier](https://github.com/xuezier)提供NodeJS Apollo客户端的支持 ### Apollo NodeJS 客户端 7 项目地址:[apollo-node-client](https://github.com/zhangxh1023/apollo-node-client) > 非常感谢[@zhangxh1023](https://github.com/zhangxh1023)提供NodeJS Apollo客户端的支持 ## 4. PHP ### Apollo PHP 客户端 1 项目地址:[apollo-php-client](https://github.com/multilinguals/apollo-php-client) > 非常感谢[@t04041143](https://github.com/t04041143)提供PHP Apollo客户端的支持 ### Apollo PHP 客户端 2 项目地址:[apollo-sdk-config](https://github.com/fengzhibin/apollo-sdk-config) 项目地址:[apollo-sdk-clientd](https://github.com/fengzhibin/apollo-sdk-clientd) > 非常感谢[@fengzhibin](https://github.com/fengzhibin)提供PHP Apollo客户端的支持 ## 5. C ### Apollo C 客户端 项目地址:[apollo-c-client](https://github.com/lzeqian/apollo) > 非常感谢[@lzeqian](https://github.com/lzeqian)提供C Apollo客户端的支持
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/META-INF/services/com.ctrip.framework.apollo.spring.spi.ConfigPropertySourcesProcessorHelper
com.ctrip.framework.apollo.spring.spi.TestProcessorHelper
com.ctrip.framework.apollo.spring.spi.TestProcessorHelper
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/ConfigPublishEmailBuilder.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.component.emailbuilder; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import com.ctrip.framework.apollo.common.constants.ReleaseOperationContext; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.constant.RoleType; import com.ctrip.framework.apollo.portal.entity.bo.Email; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.entity.vo.Change; import com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult; import com.ctrip.framework.apollo.portal.service.AppNamespaceService; import com.ctrip.framework.apollo.portal.service.ReleaseService; import com.ctrip.framework.apollo.portal.service.RolePermissionService; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.util.RoleUtils; import org.apache.commons.lang.time.FastDateFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; public abstract class ConfigPublishEmailBuilder { private static final String EMERGENCY_PUBLISH_TAG = "<span style='color:red'>(紧急发布)</span>"; //email content common field placeholder private static final String EMAIL_CONTENT_FIELD_APPID = "#\\{appId\\}"; private static final String EMAIL_CONTENT_FIELD_ENV = "#\\{env}"; private static final String EMAIL_CONTENT_FIELD_CLUSTER = "#\\{clusterName}"; private static final String EMAIL_CONTENT_FIELD_NAMESPACE = "#\\{namespaceName}"; private static final String EMAIL_CONTENT_FIELD_OPERATOR = "#\\{operator}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_TIME = "#\\{releaseTime}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_ID = "#\\{releaseId}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID = "#\\{releaseHistoryId}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_TITLE = "#\\{releaseTitle}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_COMMENT = "#\\{releaseComment}"; private static final String EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS = "#\\{apollo.portal.address}"; private static final String EMAIL_CONTENT_FIELD_DIFF_CONTENT = "#\\{diffContent}"; private static final String EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH = "#\\{emergencyPublish}"; private static final String EMAIL_CONTENT_DIFF_MODULE = "#\\{diffModule}"; protected static final String EMAIL_CONTENT_GRAY_RULES_MODULE = "#\\{rulesModule}"; //email content special field placeholder protected static final String EMAIL_CONTENT_GRAY_RULES_CONTENT = "#\\{rulesContent}"; //set config's value max length to protect email. protected static final int VALUE_MAX_LENGTH = 100; protected FastDateFormat dateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); @Autowired private RolePermissionService rolePermissionService; @Autowired private ReleaseService releaseService; @Autowired private AppNamespaceService appNamespaceService; @Autowired private UserService userService; @Autowired protected PortalConfig portalConfig; /** * email subject */ protected abstract String subject(); /** * email body content */ protected abstract String emailContent(Env env, ReleaseHistoryBO releaseHistory); /** * email body template framework */ protected abstract String getTemplateFramework(); /** * email body diff module template */ protected abstract String getDiffModuleTemplate(); public Email build(Env env, ReleaseHistoryBO releaseHistory) { Email email = new Email(); email.setSubject(subject()); email.setSenderEmailAddress(portalConfig.emailSender()); email.setRecipients(recipients(releaseHistory.getAppId(), releaseHistory.getNamespaceName(), env.toString())); String emailBody = emailContent(env, releaseHistory); //clear not used module emailBody = emailBody.replaceAll(EMAIL_CONTENT_DIFF_MODULE, ""); emailBody = emailBody.replaceAll(EMAIL_CONTENT_GRAY_RULES_MODULE, ""); email.setBody(emailBody); return email; } protected String renderEmailCommonContent(Env env, ReleaseHistoryBO releaseHistory) { String template = getTemplateFramework(); String renderResult = renderReleaseBasicInfo(template, env, releaseHistory); renderResult = renderDiffModule(renderResult, env, releaseHistory); return renderResult; } private String renderReleaseBasicInfo(String template, Env env, ReleaseHistoryBO releaseHistory) { String renderResult = template; Map<String, Object> operationContext = releaseHistory.getOperationContext(); boolean isEmergencyPublish = operationContext.containsKey(ReleaseOperationContext.IS_EMERGENCY_PUBLISH) && (boolean) operationContext.get(ReleaseOperationContext.IS_EMERGENCY_PUBLISH); if (isEmergencyPublish) { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, Matcher.quoteReplacement(EMERGENCY_PUBLISH_TAG)); } else { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, ""); } renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APPID, Matcher.quoteReplacement(releaseHistory.getAppId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_ENV, Matcher.quoteReplacement(env.toString())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_CLUSTER, Matcher.quoteReplacement(releaseHistory.getClusterName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_NAMESPACE, Matcher.quoteReplacement(releaseHistory.getNamespaceName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_OPERATOR, Matcher.quoteReplacement(releaseHistory.getOperator())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TITLE, Matcher.quoteReplacement(releaseHistory.getReleaseTitle())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_ID, String.valueOf(releaseHistory.getReleaseId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID, String.valueOf(releaseHistory.getId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_COMMENT, Matcher.quoteReplacement(releaseHistory.getReleaseComment() == null ? "" : releaseHistory.getReleaseComment())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS, getApolloPortalAddress()); return renderResult .replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TIME, dateFormat.format(releaseHistory.getReleaseTime())); } private String renderDiffModule(String bodyTemplate, Env env, ReleaseHistoryBO releaseHistory) { String appId = releaseHistory.getAppId(); String namespaceName = releaseHistory.getNamespaceName(); AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(appId, namespaceName); if (appNamespace == null) { appNamespace = appNamespaceService.findPublicAppNamespace(namespaceName); } //don't show diff content if namespace's format is file if (appNamespace == null || !appNamespace.getFormat().equals(ConfigFileFormat.Properties.getValue())) { return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, "<br><h4>变更内容请点击链接到Apollo上查看</h4>"); } ReleaseCompareResult result = getReleaseCompareResult(env, releaseHistory); if (!result.hasContent()) { return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, "<br><h4>无配置变更</h4>"); } List<Change> changes = result.getChanges(); StringBuilder changesHtmlBuilder = new StringBuilder(); for (Change change : changes) { String key = change.getEntity().getFirstEntity().getKey(); String oldValue = change.getEntity().getFirstEntity().getValue(); String newValue = change.getEntity().getSecondEntity().getValue(); newValue = newValue == null ? "" : newValue; changesHtmlBuilder.append("<tr>"); changesHtmlBuilder.append("<td width=\"10%\">").append(change.getType().toString()).append("</td>"); changesHtmlBuilder.append("<td width=\"20%\">").append(cutOffString(key)).append("</td>"); changesHtmlBuilder.append("<td width=\"35%\">").append(cutOffString(oldValue)).append("</td>"); changesHtmlBuilder.append("<td width=\"35%\">").append(cutOffString(newValue)).append("</td>"); changesHtmlBuilder.append("</tr>"); } String diffContent = Matcher.quoteReplacement(changesHtmlBuilder.toString()); String diffModuleTemplate = getDiffModuleTemplate(); String diffModuleRenderResult = diffModuleTemplate.replaceAll(EMAIL_CONTENT_FIELD_DIFF_CONTENT, diffContent); return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, diffModuleRenderResult); } private ReleaseCompareResult getReleaseCompareResult(Env env, ReleaseHistoryBO releaseHistory) { if (releaseHistory.getOperation() == ReleaseOperation.GRAY_RELEASE && releaseHistory.getPreviousReleaseId() == 0) { ReleaseDTO masterLatestActiveRelease = releaseService.loadLatestRelease( releaseHistory.getAppId(), env, releaseHistory.getClusterName(), releaseHistory.getNamespaceName()); ReleaseDTO branchLatestActiveRelease = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return releaseService.compare(masterLatestActiveRelease, branchLatestActiveRelease); } return releaseService.compare(env, releaseHistory.getPreviousReleaseId(), releaseHistory.getReleaseId()); } private List<String> recipients(String appId, String namespaceName, String env) { Set<UserInfo> modifyRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.MODIFY_NAMESPACE)); Set<UserInfo> envModifyRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.MODIFY_NAMESPACE, env)); Set<UserInfo> releaseRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.RELEASE_NAMESPACE)); Set<UserInfo> envReleaseRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.RELEASE_NAMESPACE, env)); Set<UserInfo> owners = rolePermissionService.queryUsersWithRole(RoleUtils.buildAppMasterRoleName(appId)); Set<String> userIds = new HashSet<>(modifyRoleUsers.size() + releaseRoleUsers.size() + owners.size()); for (UserInfo userInfo : modifyRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : envModifyRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : releaseRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : envReleaseRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : owners) { userIds.add(userInfo.getUserId()); } List<UserInfo> userInfos = userService.findByUserIds(Lists.newArrayList(userIds)); if (CollectionUtils.isEmpty(userInfos)) { return Collections.emptyList(); } List<String> recipients = new ArrayList<>(userInfos.size()); for (UserInfo userInfo : userInfos) { recipients.add(userInfo.getEmail()); } return recipients; } protected String getApolloPortalAddress() { return portalConfig.portalAddress(); } private String cutOffString(String source) { if (source.length() > VALUE_MAX_LENGTH) { return source.substring(0, VALUE_MAX_LENGTH) + "..."; } return source; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.component.emailbuilder; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import com.ctrip.framework.apollo.common.constants.ReleaseOperationContext; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.constant.RoleType; import com.ctrip.framework.apollo.portal.entity.bo.Email; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.entity.vo.Change; import com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult; import com.ctrip.framework.apollo.portal.service.AppNamespaceService; import com.ctrip.framework.apollo.portal.service.ReleaseService; import com.ctrip.framework.apollo.portal.service.RolePermissionService; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.util.RoleUtils; import org.apache.commons.lang.time.FastDateFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; public abstract class ConfigPublishEmailBuilder { private static final String EMERGENCY_PUBLISH_TAG = "<span style='color:red'>(紧急发布)</span>"; //email content common field placeholder private static final String EMAIL_CONTENT_FIELD_APPID = "#\\{appId\\}"; private static final String EMAIL_CONTENT_FIELD_ENV = "#\\{env}"; private static final String EMAIL_CONTENT_FIELD_CLUSTER = "#\\{clusterName}"; private static final String EMAIL_CONTENT_FIELD_NAMESPACE = "#\\{namespaceName}"; private static final String EMAIL_CONTENT_FIELD_OPERATOR = "#\\{operator}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_TIME = "#\\{releaseTime}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_ID = "#\\{releaseId}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID = "#\\{releaseHistoryId}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_TITLE = "#\\{releaseTitle}"; private static final String EMAIL_CONTENT_FIELD_RELEASE_COMMENT = "#\\{releaseComment}"; private static final String EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS = "#\\{apollo.portal.address}"; private static final String EMAIL_CONTENT_FIELD_DIFF_CONTENT = "#\\{diffContent}"; private static final String EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH = "#\\{emergencyPublish}"; private static final String EMAIL_CONTENT_DIFF_MODULE = "#\\{diffModule}"; protected static final String EMAIL_CONTENT_GRAY_RULES_MODULE = "#\\{rulesModule}"; //email content special field placeholder protected static final String EMAIL_CONTENT_GRAY_RULES_CONTENT = "#\\{rulesContent}"; //set config's value max length to protect email. protected static final int VALUE_MAX_LENGTH = 100; protected FastDateFormat dateFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); @Autowired private RolePermissionService rolePermissionService; @Autowired private ReleaseService releaseService; @Autowired private AppNamespaceService appNamespaceService; @Autowired private UserService userService; @Autowired protected PortalConfig portalConfig; /** * email subject */ protected abstract String subject(); /** * email body content */ protected abstract String emailContent(Env env, ReleaseHistoryBO releaseHistory); /** * email body template framework */ protected abstract String getTemplateFramework(); /** * email body diff module template */ protected abstract String getDiffModuleTemplate(); public Email build(Env env, ReleaseHistoryBO releaseHistory) { Email email = new Email(); email.setSubject(subject()); email.setSenderEmailAddress(portalConfig.emailSender()); email.setRecipients(recipients(releaseHistory.getAppId(), releaseHistory.getNamespaceName(), env.toString())); String emailBody = emailContent(env, releaseHistory); //clear not used module emailBody = emailBody.replaceAll(EMAIL_CONTENT_DIFF_MODULE, ""); emailBody = emailBody.replaceAll(EMAIL_CONTENT_GRAY_RULES_MODULE, ""); email.setBody(emailBody); return email; } protected String renderEmailCommonContent(Env env, ReleaseHistoryBO releaseHistory) { String template = getTemplateFramework(); String renderResult = renderReleaseBasicInfo(template, env, releaseHistory); renderResult = renderDiffModule(renderResult, env, releaseHistory); return renderResult; } private String renderReleaseBasicInfo(String template, Env env, ReleaseHistoryBO releaseHistory) { String renderResult = template; Map<String, Object> operationContext = releaseHistory.getOperationContext(); boolean isEmergencyPublish = operationContext.containsKey(ReleaseOperationContext.IS_EMERGENCY_PUBLISH) && (boolean) operationContext.get(ReleaseOperationContext.IS_EMERGENCY_PUBLISH); if (isEmergencyPublish) { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, Matcher.quoteReplacement(EMERGENCY_PUBLISH_TAG)); } else { renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_EMERGENCY_PUBLISH, ""); } renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APPID, Matcher.quoteReplacement(releaseHistory.getAppId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_ENV, Matcher.quoteReplacement(env.toString())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_CLUSTER, Matcher.quoteReplacement(releaseHistory.getClusterName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_NAMESPACE, Matcher.quoteReplacement(releaseHistory.getNamespaceName())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_OPERATOR, Matcher.quoteReplacement(releaseHistory.getOperator())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TITLE, Matcher.quoteReplacement(releaseHistory.getReleaseTitle())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_ID, String.valueOf(releaseHistory.getReleaseId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID, String.valueOf(releaseHistory.getId())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_COMMENT, Matcher.quoteReplacement(releaseHistory.getReleaseComment() == null ? "" : releaseHistory.getReleaseComment())); renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS, getApolloPortalAddress()); return renderResult .replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TIME, dateFormat.format(releaseHistory.getReleaseTime())); } private String renderDiffModule(String bodyTemplate, Env env, ReleaseHistoryBO releaseHistory) { String appId = releaseHistory.getAppId(); String namespaceName = releaseHistory.getNamespaceName(); AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(appId, namespaceName); if (appNamespace == null) { appNamespace = appNamespaceService.findPublicAppNamespace(namespaceName); } //don't show diff content if namespace's format is file if (appNamespace == null || !appNamespace.getFormat().equals(ConfigFileFormat.Properties.getValue())) { return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, "<br><h4>变更内容请点击链接到Apollo上查看</h4>"); } ReleaseCompareResult result = getReleaseCompareResult(env, releaseHistory); if (!result.hasContent()) { return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, "<br><h4>无配置变更</h4>"); } List<Change> changes = result.getChanges(); StringBuilder changesHtmlBuilder = new StringBuilder(); for (Change change : changes) { String key = change.getEntity().getFirstEntity().getKey(); String oldValue = change.getEntity().getFirstEntity().getValue(); String newValue = change.getEntity().getSecondEntity().getValue(); newValue = newValue == null ? "" : newValue; changesHtmlBuilder.append("<tr>"); changesHtmlBuilder.append("<td width=\"10%\">").append(change.getType().toString()).append("</td>"); changesHtmlBuilder.append("<td width=\"20%\">").append(cutOffString(key)).append("</td>"); changesHtmlBuilder.append("<td width=\"35%\">").append(cutOffString(oldValue)).append("</td>"); changesHtmlBuilder.append("<td width=\"35%\">").append(cutOffString(newValue)).append("</td>"); changesHtmlBuilder.append("</tr>"); } String diffContent = Matcher.quoteReplacement(changesHtmlBuilder.toString()); String diffModuleTemplate = getDiffModuleTemplate(); String diffModuleRenderResult = diffModuleTemplate.replaceAll(EMAIL_CONTENT_FIELD_DIFF_CONTENT, diffContent); return bodyTemplate.replaceAll(EMAIL_CONTENT_DIFF_MODULE, diffModuleRenderResult); } private ReleaseCompareResult getReleaseCompareResult(Env env, ReleaseHistoryBO releaseHistory) { if (releaseHistory.getOperation() == ReleaseOperation.GRAY_RELEASE && releaseHistory.getPreviousReleaseId() == 0) { ReleaseDTO masterLatestActiveRelease = releaseService.loadLatestRelease( releaseHistory.getAppId(), env, releaseHistory.getClusterName(), releaseHistory.getNamespaceName()); ReleaseDTO branchLatestActiveRelease = releaseService.findReleaseById(env, releaseHistory.getReleaseId()); return releaseService.compare(masterLatestActiveRelease, branchLatestActiveRelease); } return releaseService.compare(env, releaseHistory.getPreviousReleaseId(), releaseHistory.getReleaseId()); } private List<String> recipients(String appId, String namespaceName, String env) { Set<UserInfo> modifyRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.MODIFY_NAMESPACE)); Set<UserInfo> envModifyRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.MODIFY_NAMESPACE, env)); Set<UserInfo> releaseRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.RELEASE_NAMESPACE)); Set<UserInfo> envReleaseRoleUsers = rolePermissionService .queryUsersWithRole(RoleUtils.buildNamespaceRoleName(appId, namespaceName, RoleType.RELEASE_NAMESPACE, env)); Set<UserInfo> owners = rolePermissionService.queryUsersWithRole(RoleUtils.buildAppMasterRoleName(appId)); Set<String> userIds = new HashSet<>(modifyRoleUsers.size() + releaseRoleUsers.size() + owners.size()); for (UserInfo userInfo : modifyRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : envModifyRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : releaseRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : envReleaseRoleUsers) { userIds.add(userInfo.getUserId()); } for (UserInfo userInfo : owners) { userIds.add(userInfo.getUserId()); } List<UserInfo> userInfos = userService.findByUserIds(Lists.newArrayList(userIds)); if (CollectionUtils.isEmpty(userInfos)) { return Collections.emptyList(); } List<String> recipients = new ArrayList<>(userInfos.size()); for (UserInfo userInfo : userInfos) { recipients.add(userInfo.getEmail()); } return recipients; } protected String getApolloPortalAddress() { return portalConfig.portalAddress(); } private String cutOffString(String source) { if (source.length() > VALUE_MAX_LENGTH) { return source.substring(0, VALUE_MAX_LENGTH) + "..."; } return source; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; import java.util.Set; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigFile; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.util.ConfigUtil; /** * @author Jason Song([email protected]) */ public class DefaultConfigManagerTest { private DefaultConfigManager defaultConfigManager; private static String someConfigContent; @Before public void setUp() throws Exception { MockInjector.setInstance(ConfigFactoryManager.class, new MockConfigFactoryManager()); MockInjector.setInstance(ConfigUtil.class, new ConfigUtil()); defaultConfigManager = new DefaultConfigManager(); someConfigContent = "someContent"; } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testGetConfig() throws Exception { String someNamespace = "someName"; String anotherNamespace = "anotherName"; String someKey = "someKey"; Config config = defaultConfigManager.getConfig(someNamespace); Config anotherConfig = defaultConfigManager.getConfig(anotherNamespace); assertEquals(someNamespace + ":" + someKey, config.getProperty(someKey, null)); assertEquals(anotherNamespace + ":" + someKey, anotherConfig.getProperty(someKey, null)); } @Test public void testGetConfigMultipleTimesWithSameNamespace() throws Exception { String someNamespace = "someName"; Config config = defaultConfigManager.getConfig(someNamespace); Config anotherConfig = defaultConfigManager.getConfig(someNamespace); assertThat( "Get config multiple times with the same namespace should return the same config instance", config, equalTo(anotherConfig)); } @Test public void testGetConfigFile() throws Exception { String someNamespace = "someName"; ConfigFileFormat someConfigFileFormat = ConfigFileFormat.Properties; ConfigFile configFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); assertEquals(someConfigFileFormat, configFile.getConfigFileFormat()); assertEquals(someConfigContent, configFile.getContent()); } @Test public void testGetConfigFileMultipleTimesWithSameNamespace() throws Exception { String someNamespace = "someName"; ConfigFileFormat someConfigFileFormat = ConfigFileFormat.Properties; ConfigFile someConfigFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); ConfigFile anotherConfigFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); assertThat( "Get config file multiple times with the same namespace should return the same config file instance", someConfigFile, equalTo(anotherConfigFile)); } public static class MockConfigFactoryManager implements ConfigFactoryManager { @Override public ConfigFactory getFactory(String namespace) { return new ConfigFactory() { @Override public Config create(final String namespace) { return new AbstractConfig() { @Override public String getProperty(String key, String defaultValue) { return namespace + ":" + key; } @Override public Set<String> getPropertyNames() { return null; } @Override public ConfigSourceType getSourceType() { return null; } }; } @Override public ConfigFile createConfigFile(String namespace, final ConfigFileFormat configFileFormat) { ConfigRepository someConfigRepository = mock(ConfigRepository.class); return new AbstractConfigFile(namespace, someConfigRepository) { @Override protected void update(Properties newProperties) { } @Override public String getContent() { return someConfigContent; } @Override public boolean hasContent() { return true; } @Override public ConfigFileFormat getConfigFileFormat() { return configFileFormat; } }; } }; } } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.internals; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; import java.util.Set; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigFile; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.util.ConfigUtil; /** * @author Jason Song([email protected]) */ public class DefaultConfigManagerTest { private DefaultConfigManager defaultConfigManager; private static String someConfigContent; @Before public void setUp() throws Exception { MockInjector.setInstance(ConfigFactoryManager.class, new MockConfigFactoryManager()); MockInjector.setInstance(ConfigUtil.class, new ConfigUtil()); defaultConfigManager = new DefaultConfigManager(); someConfigContent = "someContent"; } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testGetConfig() throws Exception { String someNamespace = "someName"; String anotherNamespace = "anotherName"; String someKey = "someKey"; Config config = defaultConfigManager.getConfig(someNamespace); Config anotherConfig = defaultConfigManager.getConfig(anotherNamespace); assertEquals(someNamespace + ":" + someKey, config.getProperty(someKey, null)); assertEquals(anotherNamespace + ":" + someKey, anotherConfig.getProperty(someKey, null)); } @Test public void testGetConfigMultipleTimesWithSameNamespace() throws Exception { String someNamespace = "someName"; Config config = defaultConfigManager.getConfig(someNamespace); Config anotherConfig = defaultConfigManager.getConfig(someNamespace); assertThat( "Get config multiple times with the same namespace should return the same config instance", config, equalTo(anotherConfig)); } @Test public void testGetConfigFile() throws Exception { String someNamespace = "someName"; ConfigFileFormat someConfigFileFormat = ConfigFileFormat.Properties; ConfigFile configFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); assertEquals(someConfigFileFormat, configFile.getConfigFileFormat()); assertEquals(someConfigContent, configFile.getContent()); } @Test public void testGetConfigFileMultipleTimesWithSameNamespace() throws Exception { String someNamespace = "someName"; ConfigFileFormat someConfigFileFormat = ConfigFileFormat.Properties; ConfigFile someConfigFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); ConfigFile anotherConfigFile = defaultConfigManager.getConfigFile(someNamespace, someConfigFileFormat); assertThat( "Get config file multiple times with the same namespace should return the same config file instance", someConfigFile, equalTo(anotherConfigFile)); } public static class MockConfigFactoryManager implements ConfigFactoryManager { @Override public ConfigFactory getFactory(String namespace) { return new ConfigFactory() { @Override public Config create(final String namespace) { return new AbstractConfig() { @Override public String getProperty(String key, String defaultValue) { return namespace + ":" + key; } @Override public Set<String> getPropertyNames() { return null; } @Override public ConfigSourceType getSourceType() { return null; } }; } @Override public ConfigFile createConfigFile(String namespace, final ConfigFileFormat configFileFormat) { ConfigRepository someConfigRepository = mock(ConfigRepository.class); return new AbstractConfigFile(namespace, someConfigRepository) { @Override protected void update(Properties newProperties) { } @Override public String getContent() { return someConfigContent; } @Override public boolean hasContent() { return true; } @Override public ConfigFileFormat getConfigFileFormat() { return configFileFormat; } }; } }; } } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/InstanceConfigRepository.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.biz.repository; import com.ctrip.framework.apollo.biz.entity.InstanceConfig; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import java.util.Date; import java.util.List; import java.util.Set; public interface InstanceConfigRepository extends PagingAndSortingRepository<InstanceConfig, Long> { InstanceConfig findByInstanceIdAndConfigAppIdAndConfigNamespaceName(long instanceId, String configAppId, String configNamespaceName); Page<InstanceConfig> findByReleaseKeyAndDataChangeLastModifiedTimeAfter(String releaseKey, Date validDate, Pageable pageable); Page<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter( String appId, String clusterName, String namespaceName, Date validDate, Pageable pageable); List<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfterAndReleaseKeyNotIn( String appId, String clusterName, String namespaceName, Date validDate, Set<String> releaseKey); @Modifying @Query("delete from InstanceConfig where ConfigAppId=?1 and ConfigClusterName=?2 and ConfigNamespaceName = ?3") int batchDelete(String appId, String clusterName, String namespaceName); @Query( value = "select b.Id from `InstanceConfig` a inner join `Instance` b on b.Id =" + " a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " + ":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " + "> :validDate and b.`AppId` = :instanceAppId", countQuery = "select count(1) from `InstanceConfig` a inner join `Instance` b on b.id =" + " a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " + ":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " + "> :validDate and b.`AppId` = :instanceAppId", nativeQuery = true) Page<Object> findInstanceIdsByNamespaceAndInstanceAppId( @Param("instanceAppId") String instanceAppId, @Param("configAppId") String configAppId, @Param("clusterName") String clusterName, @Param("namespaceName") String namespaceName, @Param("validDate") Date validDate, Pageable pageable); }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.biz.repository; import com.ctrip.framework.apollo.biz.entity.InstanceConfig; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import java.util.Date; import java.util.List; import java.util.Set; public interface InstanceConfigRepository extends PagingAndSortingRepository<InstanceConfig, Long> { InstanceConfig findByInstanceIdAndConfigAppIdAndConfigNamespaceName(long instanceId, String configAppId, String configNamespaceName); Page<InstanceConfig> findByReleaseKeyAndDataChangeLastModifiedTimeAfter(String releaseKey, Date validDate, Pageable pageable); Page<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter( String appId, String clusterName, String namespaceName, Date validDate, Pageable pageable); List<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfterAndReleaseKeyNotIn( String appId, String clusterName, String namespaceName, Date validDate, Set<String> releaseKey); @Modifying @Query("delete from InstanceConfig where ConfigAppId=?1 and ConfigClusterName=?2 and ConfigNamespaceName = ?3") int batchDelete(String appId, String clusterName, String namespaceName); @Query( value = "select b.Id from `InstanceConfig` a inner join `Instance` b on b.Id =" + " a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " + ":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " + "> :validDate and b.`AppId` = :instanceAppId", countQuery = "select count(1) from `InstanceConfig` a inner join `Instance` b on b.id =" + " a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " + ":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " + "> :validDate and b.`AppId` = :instanceAppId", nativeQuery = true) Page<Object> findInstanceIdsByNamespaceAndInstanceAppId( @Param("instanceAppId") String instanceAppId, @Param("configAppId") String configAppId, @Param("clusterName") String clusterName, @Param("namespaceName") String namespaceName, @Param("validDate") Date validDate, Pageable pageable); }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileController.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.biz.message.ReleaseMessageListener; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.utils.PropertiesUtil; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.cache.Weigher; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.gson.Gson; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.Set; import java.util.concurrent.TimeUnit; /** * @author Jason Song([email protected]) */ @RestController @RequestMapping("/configfiles") public class ConfigFileController implements ReleaseMessageListener { private static final Logger logger = LoggerFactory.getLogger(ConfigFileController.class); private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR); private static final Splitter X_FORWARDED_FOR_SPLITTER = Splitter.on(",").omitEmptyStrings() .trimResults(); private static final long MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB private static final long EXPIRE_AFTER_WRITE = 30; private final HttpHeaders propertiesResponseHeaders; private final HttpHeaders jsonResponseHeaders; private final ResponseEntity<String> NOT_FOUND_RESPONSE; private Cache<String, String> localCache; private final Multimap<String, String> watchedKeys2CacheKey = Multimaps.synchronizedSetMultimap(HashMultimap.create()); private final Multimap<String, String> cacheKey2WatchedKeys = Multimaps.synchronizedSetMultimap(HashMultimap.create()); private static final Gson GSON = new Gson(); private final ConfigController configController; private final NamespaceUtil namespaceUtil; private final WatchKeysUtil watchKeysUtil; private final GrayReleaseRulesHolder grayReleaseRulesHolder; public ConfigFileController( final ConfigController configController, final NamespaceUtil namespaceUtil, final WatchKeysUtil watchKeysUtil, final GrayReleaseRulesHolder grayReleaseRulesHolder) { localCache = CacheBuilder.newBuilder() .expireAfterWrite(EXPIRE_AFTER_WRITE, TimeUnit.MINUTES) .weigher((Weigher<String, String>) (key, value) -> value == null ? 0 : value.length()) .maximumWeight(MAX_CACHE_SIZE) .removalListener(notification -> { String cacheKey = notification.getKey(); logger.debug("removing cache key: {}", cacheKey); if (!cacheKey2WatchedKeys.containsKey(cacheKey)) { return; } //create a new list to avoid ConcurrentModificationException List<String> watchedKeys = new ArrayList<>(cacheKey2WatchedKeys.get(cacheKey)); for (String watchedKey : watchedKeys) { watchedKeys2CacheKey.remove(watchedKey, cacheKey); } cacheKey2WatchedKeys.removeAll(cacheKey); logger.debug("removed cache key: {}", cacheKey); }) .build(); propertiesResponseHeaders = new HttpHeaders(); propertiesResponseHeaders.add("Content-Type", "text/plain;charset=UTF-8"); jsonResponseHeaders = new HttpHeaders(); jsonResponseHeaders.add("Content-Type", "application/json;charset=UTF-8"); NOT_FOUND_RESPONSE = new ResponseEntity<>(HttpStatus.NOT_FOUND); this.configController = configController; this.namespaceUtil = namespaceUtil; this.watchKeysUtil = watchKeysUtil; this.grayReleaseRulesHolder = grayReleaseRulesHolder; } @GetMapping(value = "/{appId}/{clusterName}/{namespace:.+}") public ResponseEntity<String> queryConfigAsProperties(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "ip", required = false) String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { String result = queryConfig(ConfigFileOutputFormat.PROPERTIES, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return NOT_FOUND_RESPONSE; } return new ResponseEntity<>(result, propertiesResponseHeaders, HttpStatus.OK); } @GetMapping(value = "/json/{appId}/{clusterName}/{namespace:.+}") public ResponseEntity<String> queryConfigAsJson(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "ip", required = false) String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { String result = queryConfig(ConfigFileOutputFormat.JSON, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return NOT_FOUND_RESPONSE; } return new ResponseEntity<>(result, jsonResponseHeaders, HttpStatus.OK); } String queryConfig(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter, String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { //strip out .properties suffix namespace = namespaceUtil.filterNamespaceName(namespace); //fix the character case issue, such as FX.apollo <-> fx.apollo namespace = namespaceUtil.normalizeNamespace(appId, namespace); if (Strings.isNullOrEmpty(clientIp)) { clientIp = tryToGetClientIp(request); } //1. check whether this client has gray release rules boolean hasGrayReleaseRule = grayReleaseRulesHolder.hasGrayReleaseRule(appId, clientIp, namespace); String cacheKey = assembleCacheKey(outputFormat, appId, clusterName, namespace, dataCenter); //2. try to load gray release and return if (hasGrayReleaseRule) { Tracer.logEvent("ConfigFile.Cache.GrayRelease", cacheKey); return loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); } //3. if not gray release, check weather cache exists, if exists, return String result = localCache.getIfPresent(cacheKey); //4. if not exists, load from ConfigController if (Strings.isNullOrEmpty(result)) { Tracer.logEvent("ConfigFile.Cache.Miss", cacheKey); result = loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return null; } //5. Double check if this client needs to load gray release, if yes, load from db again //This step is mainly to avoid cache pollution if (grayReleaseRulesHolder.hasGrayReleaseRule(appId, clientIp, namespace)) { Tracer.logEvent("ConfigFile.Cache.GrayReleaseConflict", cacheKey); return loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); } localCache.put(cacheKey, result); logger.debug("adding cache for key: {}", cacheKey); Set<String> watchedKeys = watchKeysUtil.assembleAllWatchKeys(appId, clusterName, namespace, dataCenter); for (String watchedKey : watchedKeys) { watchedKeys2CacheKey.put(watchedKey, cacheKey); } cacheKey2WatchedKeys.putAll(cacheKey, watchedKeys); logger.debug("added cache for key: {}", cacheKey); } else { Tracer.logEvent("ConfigFile.Cache.Hit", cacheKey); } return result; } private String loadConfig(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter, String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { ApolloConfig apolloConfig = configController.queryConfig(appId, clusterName, namespace, dataCenter, "-1", clientIp, null, request, response); if (apolloConfig == null || apolloConfig.getConfigurations() == null) { return null; } String result = null; switch (outputFormat) { case PROPERTIES: Properties properties = new Properties(); properties.putAll(apolloConfig.getConfigurations()); result = PropertiesUtil.toString(properties); break; case JSON: result = GSON.toJson(apolloConfig.getConfigurations()); break; } return result; } String assembleCacheKey(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(outputFormat.getValue(), appId, clusterName, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return STRING_JOINER.join(keyParts); } @Override public void handleMessage(ReleaseMessage message, String channel) { logger.info("message received - channel: {}, message: {}", channel, message); String content = message.getMessage(); if (!Topics.APOLLO_RELEASE_TOPIC.equals(channel) || Strings.isNullOrEmpty(content)) { return; } if (!watchedKeys2CacheKey.containsKey(content)) { return; } //create a new list to avoid ConcurrentModificationException List<String> cacheKeys = new ArrayList<>(watchedKeys2CacheKey.get(content)); for (String cacheKey : cacheKeys) { logger.debug("invalidate cache key: {}", cacheKey); localCache.invalidate(cacheKey); } } enum ConfigFileOutputFormat { PROPERTIES("properties"), JSON("json"); private String value; ConfigFileOutputFormat(String value) { this.value = value; } public String getValue() { return value; } } private String tryToGetClientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-FORWARDED-FOR"); if (!Strings.isNullOrEmpty(forwardedFor)) { return X_FORWARDED_FOR_SPLITTER.splitToList(forwardedFor).get(0); } return request.getRemoteAddr(); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.biz.message.ReleaseMessageListener; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.utils.PropertiesUtil; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.cache.Weigher; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.gson.Gson; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.Set; import java.util.concurrent.TimeUnit; /** * @author Jason Song([email protected]) */ @RestController @RequestMapping("/configfiles") public class ConfigFileController implements ReleaseMessageListener { private static final Logger logger = LoggerFactory.getLogger(ConfigFileController.class); private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR); private static final Splitter X_FORWARDED_FOR_SPLITTER = Splitter.on(",").omitEmptyStrings() .trimResults(); private static final long MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB private static final long EXPIRE_AFTER_WRITE = 30; private final HttpHeaders propertiesResponseHeaders; private final HttpHeaders jsonResponseHeaders; private final ResponseEntity<String> NOT_FOUND_RESPONSE; private Cache<String, String> localCache; private final Multimap<String, String> watchedKeys2CacheKey = Multimaps.synchronizedSetMultimap(HashMultimap.create()); private final Multimap<String, String> cacheKey2WatchedKeys = Multimaps.synchronizedSetMultimap(HashMultimap.create()); private static final Gson GSON = new Gson(); private final ConfigController configController; private final NamespaceUtil namespaceUtil; private final WatchKeysUtil watchKeysUtil; private final GrayReleaseRulesHolder grayReleaseRulesHolder; public ConfigFileController( final ConfigController configController, final NamespaceUtil namespaceUtil, final WatchKeysUtil watchKeysUtil, final GrayReleaseRulesHolder grayReleaseRulesHolder) { localCache = CacheBuilder.newBuilder() .expireAfterWrite(EXPIRE_AFTER_WRITE, TimeUnit.MINUTES) .weigher((Weigher<String, String>) (key, value) -> value == null ? 0 : value.length()) .maximumWeight(MAX_CACHE_SIZE) .removalListener(notification -> { String cacheKey = notification.getKey(); logger.debug("removing cache key: {}", cacheKey); if (!cacheKey2WatchedKeys.containsKey(cacheKey)) { return; } //create a new list to avoid ConcurrentModificationException List<String> watchedKeys = new ArrayList<>(cacheKey2WatchedKeys.get(cacheKey)); for (String watchedKey : watchedKeys) { watchedKeys2CacheKey.remove(watchedKey, cacheKey); } cacheKey2WatchedKeys.removeAll(cacheKey); logger.debug("removed cache key: {}", cacheKey); }) .build(); propertiesResponseHeaders = new HttpHeaders(); propertiesResponseHeaders.add("Content-Type", "text/plain;charset=UTF-8"); jsonResponseHeaders = new HttpHeaders(); jsonResponseHeaders.add("Content-Type", "application/json;charset=UTF-8"); NOT_FOUND_RESPONSE = new ResponseEntity<>(HttpStatus.NOT_FOUND); this.configController = configController; this.namespaceUtil = namespaceUtil; this.watchKeysUtil = watchKeysUtil; this.grayReleaseRulesHolder = grayReleaseRulesHolder; } @GetMapping(value = "/{appId}/{clusterName}/{namespace:.+}") public ResponseEntity<String> queryConfigAsProperties(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "ip", required = false) String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { String result = queryConfig(ConfigFileOutputFormat.PROPERTIES, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return NOT_FOUND_RESPONSE; } return new ResponseEntity<>(result, propertiesResponseHeaders, HttpStatus.OK); } @GetMapping(value = "/json/{appId}/{clusterName}/{namespace:.+}") public ResponseEntity<String> queryConfigAsJson(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "ip", required = false) String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { String result = queryConfig(ConfigFileOutputFormat.JSON, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return NOT_FOUND_RESPONSE; } return new ResponseEntity<>(result, jsonResponseHeaders, HttpStatus.OK); } String queryConfig(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter, String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { //strip out .properties suffix namespace = namespaceUtil.filterNamespaceName(namespace); //fix the character case issue, such as FX.apollo <-> fx.apollo namespace = namespaceUtil.normalizeNamespace(appId, namespace); if (Strings.isNullOrEmpty(clientIp)) { clientIp = tryToGetClientIp(request); } //1. check whether this client has gray release rules boolean hasGrayReleaseRule = grayReleaseRulesHolder.hasGrayReleaseRule(appId, clientIp, namespace); String cacheKey = assembleCacheKey(outputFormat, appId, clusterName, namespace, dataCenter); //2. try to load gray release and return if (hasGrayReleaseRule) { Tracer.logEvent("ConfigFile.Cache.GrayRelease", cacheKey); return loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); } //3. if not gray release, check weather cache exists, if exists, return String result = localCache.getIfPresent(cacheKey); //4. if not exists, load from ConfigController if (Strings.isNullOrEmpty(result)) { Tracer.logEvent("ConfigFile.Cache.Miss", cacheKey); result = loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); if (result == null) { return null; } //5. Double check if this client needs to load gray release, if yes, load from db again //This step is mainly to avoid cache pollution if (grayReleaseRulesHolder.hasGrayReleaseRule(appId, clientIp, namespace)) { Tracer.logEvent("ConfigFile.Cache.GrayReleaseConflict", cacheKey); return loadConfig(outputFormat, appId, clusterName, namespace, dataCenter, clientIp, request, response); } localCache.put(cacheKey, result); logger.debug("adding cache for key: {}", cacheKey); Set<String> watchedKeys = watchKeysUtil.assembleAllWatchKeys(appId, clusterName, namespace, dataCenter); for (String watchedKey : watchedKeys) { watchedKeys2CacheKey.put(watchedKey, cacheKey); } cacheKey2WatchedKeys.putAll(cacheKey, watchedKeys); logger.debug("added cache for key: {}", cacheKey); } else { Tracer.logEvent("ConfigFile.Cache.Hit", cacheKey); } return result; } private String loadConfig(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter, String clientIp, HttpServletRequest request, HttpServletResponse response) throws IOException { ApolloConfig apolloConfig = configController.queryConfig(appId, clusterName, namespace, dataCenter, "-1", clientIp, null, request, response); if (apolloConfig == null || apolloConfig.getConfigurations() == null) { return null; } String result = null; switch (outputFormat) { case PROPERTIES: Properties properties = new Properties(); properties.putAll(apolloConfig.getConfigurations()); result = PropertiesUtil.toString(properties); break; case JSON: result = GSON.toJson(apolloConfig.getConfigurations()); break; } return result; } String assembleCacheKey(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(outputFormat.getValue(), appId, clusterName, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return STRING_JOINER.join(keyParts); } @Override public void handleMessage(ReleaseMessage message, String channel) { logger.info("message received - channel: {}, message: {}", channel, message); String content = message.getMessage(); if (!Topics.APOLLO_RELEASE_TOPIC.equals(channel) || Strings.isNullOrEmpty(content)) { return; } if (!watchedKeys2CacheKey.containsKey(content)) { return; } //create a new list to avoid ConcurrentModificationException List<String> cacheKeys = new ArrayList<>(watchedKeys2CacheKey.get(content)); for (String cacheKey : cacheKeys) { logger.debug("invalidate cache key: {}", cacheKey); localCache.invalidate(cacheKey); } } enum ConfigFileOutputFormat { PROPERTIES("properties"), JSON("json"); private String value; ConfigFileOutputFormat(String value) { this.value = value; } public String getValue() { return value; } } private String tryToGetClientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-FORWARDED-FOR"); if (!Strings.isNullOrEmpty(forwardedFor)) { return X_FORWARDED_FOR_SPLITTER.splitToList(forwardedFor).get(0); } return request.getRemoteAddr(); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./.github/ISSUE_TEMPLATE/bug_report_en.md
--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- <!-- The content in here will not be show。To forbid duplication,easier search in the feature,before you create an issue,please check the following. If your question is a newer/beginner's,recommand to https://github.com/ctripcorp/apollo/discussions to ask it. --> - [ ] I have checked the [discussions](https://github.com/ctripcorp/apollo/discussions) - [ ] I have searched the [issues](https://github.com/ctripcorp/apollo/issues) of this repository and believe that this is not a duplicate. - [ ] I have checked the [FAQ](https://www.apolloconfig.com/#/zh/faq/common-issues-in-deployment-and-development-phase) of this repository and believe that this is not a duplicate. **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. 2. 3. 4. **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. ### Additional Details & Logs - Version - Error logs - Configuration - Platform and Operating System
--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- <!-- The content in here will not be show。To forbid duplication,easier search in the feature,before you create an issue,please check the following. If your question is a newer/beginner's,recommand to https://github.com/ctripcorp/apollo/discussions to ask it. --> - [ ] I have checked the [discussions](https://github.com/ctripcorp/apollo/discussions) - [ ] I have searched the [issues](https://github.com/ctripcorp/apollo/issues) of this repository and believe that this is not a duplicate. - [ ] I have checked the [FAQ](https://www.apolloconfig.com/#/zh/faq/common-issues-in-deployment-and-development-phase) of this repository and believe that this is not a duplicate. **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. 2. 3. 4. **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. ### Additional Details & Logs - Version - Error logs - Configuration - Platform and Operating System
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/test/resources/log4j2.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration monitorInterval="60"> <appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="[apollo-client][%t]%d %-5p [%c] %m%n"/> </Console> <Async name="Async" includeLocation="true"> <AppenderRef ref="Console"/> </Async> </appenders> <loggers> <logger name="com.ctrip.framework.apollo" additivity="false" level="trace"> <AppenderRef ref="Async" level="WARN"/> </logger> <root level="debug"> <AppenderRef ref="Async"/> </root> </loggers> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration monitorInterval="60"> <appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="[apollo-client][%t]%d %-5p [%c] %m%n"/> </Console> <Async name="Async" includeLocation="true"> <AppenderRef ref="Console"/> </Async> </appenders> <loggers> <logger name="com.ctrip.framework.apollo" additivity="false" level="trace"> <AppenderRef ref="Async" level="WARN"/> </logger> <root level="debug"> <AppenderRef ref="Async"/> </root> </loggers> </configuration>
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/main/java/com/ctrip/framework/foundation/internals/io/IOUtils.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.foundation.internals.io; public class IOUtils { public static final int EOF = -1; }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.foundation.internals.io; public class IOUtils { public static final int EOF = -1; }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/UserInfo.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.entity.bo; public class UserInfo { private String userId; private String name; private String email; public UserInfo() { } public UserInfo(String userId) { this.userId = userId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public boolean equals(Object o) { if (o instanceof UserInfo) { if (o == this){ return true; } UserInfo anotherUser = (UserInfo) o; return userId.equals(anotherUser.userId); } return false; } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.portal.entity.bo; public class UserInfo { private String userId; private String name; private String email; public UserInfo() { } public UserInfo(String userId) { this.userId = userId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public boolean equals(Object o) { if (o instanceof UserInfo) { if (o == this){ return true; } UserInfo anotherUser = (UserInfo) o; return userId.equals(anotherUser.userId); } return false; } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./doc/images/cluster-created.png
PNG  IHDRz IDATxUyl,^$B!ԅzf[[++c'q߉ۉmEQzG @HB@De{}{.{;|.sf<ΜPQQ " " " " " " 5GE@D@D@D@D@D@D@D@D@D@D@D@D@ZB@%GD@D@D@D@D@D@H ,-X" " " " " " tx " " 괾\GdB!xcPKh_4$.ܪ*+GD@DCYZZZ%%%EuǬ=z[(qp*i#ЦJ bIIz𞶖ԉD@D U[YY[NefZgu΋&''7ƈ8" " "p dԶY]233% |" "pF TVVZQQѱC,==󌖧; qZ=ǚ" " @H挔XMu222:HUXD@D!4w,55-nYF{D@D@D@ǔۊ2Ζxߔ@-tTOm$ kҹ'ZD@D= `d^|uUe{Fy36ǖiע9Z^D@+f@y3" " @OUC@4**" " " " " F@)tUQ85OE@D@D@D@D@D0M<5~J-" " " " " dijUTD@D@D@D@D@NSj0$ ;LS" " " " " "pj$ OR@! aZS#rjc;uMMMZjjj~G4&%%Y(j;Ƃ/99(/" " " " " qA adAA=䓆`"9r]pn;w/~.Z@4wygoqM ~駶pB޽|M h>GЦZc~OeeVD@ړ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z(1{IENDB`
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigFile.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.enums.ConfigSourceType; /** * @author Jason Song([email protected]) */ public interface ConfigFile { /** * Get file content of the namespace * @return file content, {@code null} if there is no content */ String getContent(); /** * Whether the config file has any content * @return true if it has content, false otherwise. */ boolean hasContent(); /** * Get the namespace of this config file instance * @return the namespace */ String getNamespace(); /** * Get the file format of this config file instance * @return the config file format enum */ ConfigFileFormat getConfigFileFormat(); /** * Add change listener to this config file instance. * * @param listener the config file change listener */ void addChangeListener(ConfigFileChangeListener listener); /** * Remove the change listener * * @param listener the specific config change listener to remove * @return true if the specific config change listener is found and removed */ boolean removeChangeListener(ConfigFileChangeListener listener); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type */ ConfigSourceType getSourceType(); }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.enums.ConfigSourceType; /** * @author Jason Song([email protected]) */ public interface ConfigFile { /** * Get file content of the namespace * @return file content, {@code null} if there is no content */ String getContent(); /** * Whether the config file has any content * @return true if it has content, false otherwise. */ boolean hasContent(); /** * Get the namespace of this config file instance * @return the namespace */ String getNamespace(); /** * Get the file format of this config file instance * @return the config file format enum */ ConfigFileFormat getConfigFileFormat(); /** * Add change listener to this config file instance. * * @param listener the config file change listener */ void addChangeListener(ConfigFileChangeListener listener); /** * Remove the change listener * * @param listener the specific config change listener to remove * @return true if the specific config change listener is found and removed */ boolean removeChangeListener(ConfigFileChangeListener listener); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type */ ConfigSourceType getSourceType(); }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerTest.java
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.utils.EntityManagerUtil; import com.ctrip.framework.apollo.configservice.service.ReleaseMessageServiceWithCache; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.google.common.base.Joiner; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.context.request.async.DeferredResult; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class NotificationControllerTest { private NotificationController controller; private String someAppId; private String someCluster; private String defaultNamespace; private String someDataCenter; private long someNotificationId; private String someClientIp; @Mock private ReleaseMessageServiceWithCache releaseMessageService; @Mock private EntityManagerUtil entityManagerUtil; @Mock private NamespaceUtil namespaceUtil; @Mock private WatchKeysUtil watchKeysUtil; private Multimap<String, DeferredResult<ResponseEntity<ApolloConfigNotification>>> deferredResults; @Before public void setUp() throws Exception { controller = new NotificationController(watchKeysUtil, releaseMessageService, entityManagerUtil, namespaceUtil); someAppId = "someAppId"; someCluster = "someCluster"; defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION; someDataCenter = "someDC"; someNotificationId = 1; someClientIp = "someClientIp"; when(namespaceUtil.filterNamespaceName(defaultNamespace)).thenReturn(defaultNamespace); deferredResults = (Multimap<String, DeferredResult<ResponseEntity<ApolloConfigNotification>>>) ReflectionTestUtils .getField(controller, "deferredResults"); } @Test public void testPollNotificationWithDefaultNamespace() throws Exception { String someWatchKey = "someKey"; String anotherWatchKey = "anotherKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithDefaultNamespaceAsFile() throws Exception { String namespace = String.format("%s.%s", defaultNamespace, "properties"); when(namespaceUtil.filterNamespaceName(namespace)).thenReturn(defaultNamespace); String someWatchKey = "someKey"; String anotherWatchKey = "anotherKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, namespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithSomeNamespaceAsFile() throws Exception { String namespace = String.format("someNamespace.xml"); when(namespaceUtil.filterNamespaceName(namespace)).thenReturn(namespace); String someWatchKey = "someKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, namespace, someDataCenter)) .thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, namespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithDefaultNamespaceWithNotificationIdOutDated() throws Exception { long notificationId = someNotificationId + 1; ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class); String someWatchKey = "someKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)) .thenReturn( watchKeys); when(someReleaseMessage.getId()).thenReturn(notificationId); when(releaseMessageService.findLatestReleaseMessageForMessages(watchKeys)) .thenReturn(someReleaseMessage); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); ResponseEntity<ApolloConfigNotification> result = (ResponseEntity<ApolloConfigNotification>) deferredResult.getResult(); assertEquals(HttpStatus.OK, result.getStatusCode()); assertEquals(defaultNamespace, result.getBody().getNamespaceName()); assertEquals(notificationId, result.getBody().getNotificationId()); } @Test public void testPollNotificationWithDefaultNamespaceAndHandleMessage() throws Exception { String someWatchKey = "someKey"; String anotherWatchKey = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(someAppId, someCluster, defaultNamespace); Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); long someId = 1; ReleaseMessage someReleaseMessage = new ReleaseMessage(anotherWatchKey); someReleaseMessage.setId(someId); controller.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); ResponseEntity<ApolloConfigNotification> response = (ResponseEntity<ApolloConfigNotification>) deferredResult.getResult(); ApolloConfigNotification notification = response.getBody(); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(defaultNamespace, notification.getNamespaceName()); assertEquals(someId, notification.getNotificationId()); } }
/* * Copyright 2021 Apollo 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 * * http://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. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.utils.EntityManagerUtil; import com.ctrip.framework.apollo.configservice.service.ReleaseMessageServiceWithCache; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.google.common.base.Joiner; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.context.request.async.DeferredResult; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class NotificationControllerTest { private NotificationController controller; private String someAppId; private String someCluster; private String defaultNamespace; private String someDataCenter; private long someNotificationId; private String someClientIp; @Mock private ReleaseMessageServiceWithCache releaseMessageService; @Mock private EntityManagerUtil entityManagerUtil; @Mock private NamespaceUtil namespaceUtil; @Mock private WatchKeysUtil watchKeysUtil; private Multimap<String, DeferredResult<ResponseEntity<ApolloConfigNotification>>> deferredResults; @Before public void setUp() throws Exception { controller = new NotificationController(watchKeysUtil, releaseMessageService, entityManagerUtil, namespaceUtil); someAppId = "someAppId"; someCluster = "someCluster"; defaultNamespace = ConfigConsts.NAMESPACE_APPLICATION; someDataCenter = "someDC"; someNotificationId = 1; someClientIp = "someClientIp"; when(namespaceUtil.filterNamespaceName(defaultNamespace)).thenReturn(defaultNamespace); deferredResults = (Multimap<String, DeferredResult<ResponseEntity<ApolloConfigNotification>>>) ReflectionTestUtils .getField(controller, "deferredResults"); } @Test public void testPollNotificationWithDefaultNamespace() throws Exception { String someWatchKey = "someKey"; String anotherWatchKey = "anotherKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithDefaultNamespaceAsFile() throws Exception { String namespace = String.format("%s.%s", defaultNamespace, "properties"); when(namespaceUtil.filterNamespaceName(namespace)).thenReturn(defaultNamespace); String someWatchKey = "someKey"; String anotherWatchKey = "anotherKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, namespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithSomeNamespaceAsFile() throws Exception { String namespace = String.format("someNamespace.xml"); when(namespaceUtil.filterNamespaceName(namespace)).thenReturn(namespace); String someWatchKey = "someKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, namespace, someDataCenter)) .thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, namespace, someDataCenter, someNotificationId, someClientIp); assertEquals(watchKeys.size(), deferredResults.size()); for (String watchKey : watchKeys) { assertTrue(deferredResults.get(watchKey).contains(deferredResult)); } } @Test public void testPollNotificationWithDefaultNamespaceWithNotificationIdOutDated() throws Exception { long notificationId = someNotificationId + 1; ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class); String someWatchKey = "someKey"; Set<String> watchKeys = Sets.newHashSet(someWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)) .thenReturn( watchKeys); when(someReleaseMessage.getId()).thenReturn(notificationId); when(releaseMessageService.findLatestReleaseMessageForMessages(watchKeys)) .thenReturn(someReleaseMessage); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); ResponseEntity<ApolloConfigNotification> result = (ResponseEntity<ApolloConfigNotification>) deferredResult.getResult(); assertEquals(HttpStatus.OK, result.getStatusCode()); assertEquals(defaultNamespace, result.getBody().getNamespaceName()); assertEquals(notificationId, result.getBody().getNotificationId()); } @Test public void testPollNotificationWithDefaultNamespaceAndHandleMessage() throws Exception { String someWatchKey = "someKey"; String anotherWatchKey = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(someAppId, someCluster, defaultNamespace); Set<String> watchKeys = Sets.newHashSet(someWatchKey, anotherWatchKey); when(watchKeysUtil .assembleAllWatchKeys(someAppId, someCluster, defaultNamespace, someDataCenter)).thenReturn( watchKeys); DeferredResult<ResponseEntity<ApolloConfigNotification>> deferredResult = controller .pollNotification(someAppId, someCluster, defaultNamespace, someDataCenter, someNotificationId, someClientIp); long someId = 1; ReleaseMessage someReleaseMessage = new ReleaseMessage(anotherWatchKey); someReleaseMessage.setId(someId); controller.handleMessage(someReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); ResponseEntity<ApolloConfigNotification> response = (ResponseEntity<ApolloConfigNotification>) deferredResult.getResult(); ApolloConfigNotification notification = response.getBody(); assertEquals(HttpStatus.OK, response.getStatusCode()); assertEquals(defaultNamespace, notification.getNamespaceName()); assertEquals(someId, notification.getNotificationId()); } }
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/main/resources/logback.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-configservice.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo 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 ~ ~ http://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. ~ --> <configuration> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-configservice.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
-1
apolloconfig/apollo
3,647
feat(open-api): get authorized apps
## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Anilople
2021-04-24T06:40:38Z
2021-06-26T13:21:02Z
9a6f8e277f678fa583a23f551ed1648d5e13bdfa
f1eca02f4033d050bd71ede288d1707954d3dea4
feat(open-api): get authorized apps. ## What's the purpose of this PR Let open api know that which applications it can operate. ## Which issue(s) this PR fixes: Relate to #3607 ## Brief changelog Add a new controller in portal Add a new method in ApolloOpenApiClient Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./doc/images/override-public-namespace-item-publish-entry.png
PNG  IHDRz#\T IDATx|هWe^l0jJB$W+!_z!F 4 wLu.˲uG^NFe۝yvv;%TV^#`0F#`0@ Ng0F#`0F0Aj#`0F#` .n'5F#`0FV0F#`0FK vR#`0F#`6#)2F#`0F#` [ߥ"/P(ʊR74o#`0F#`eԔTeSY:X,zQZZڡn0F#`0@]]*ZQNcJOOwܖ0F#`0F[VVX<p`1jTaVVt#`0F`? Bs?ч3$ʆEKh7Fk#`0{M`FW||~ Yي͜/Vh`EbM #K`#` `0F7k/)HV+wz!P\ ?t=_*<yR1EQö^oV#` gh)#`8 (tW kt)dT}HMUtR;*MWFzRRRLzFi!M!}F#`:3OH+WH5(Ж~PبEJCk4i<V5+)m"5:O'h!ugI#У ї2o0F WPc 3qjtHZuQ]J}Lx\kTU5[;i$bIZj&H 0FtQ9UZbܵSEO`cZyR%BիF233m^-Ft 1F#phh7xSo>}(%5EPXp܍^x7Քʡ1766yXH `44F#`%bfpXii DB OٍϪR^2'B;/-Og:S9VB))φPJ5UVVٮLZڹsw󠠠qNvo8ǜ>Y-55q+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th并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/app.html
<!doctype html> <html ng-app="create_app"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'App.CreateProject' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel"> <header class="panel-heading"> {{'App.CreateProject' | translate }} </header> <form class="form-horizontal panel-body" name="appForm" ng-controller="CreateAppController" valdr-type="App" ng-submit="create()"> <div class="form-group"> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.Department' | translate }}</label> <div class="col-sm-3"> <select id="organization"> <option></option> </select> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }}</label> <div class="col-sm-3"> <input type="text" class="form-control" name="appId" ng-model="app.appId"> <small>{{'App.AppIdTips' | translate }} </small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppName' | translate }}</label> <div class="col-sm-5"> <input type="text" class="form-control" name="appName" ng-model="app.name"> <small>{{'App.AppNameTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppOwnerLong' | translate }}</label> <div class="col-sm-6 J_ownerSelectorPanel"> <apollouserselector apollo-id="'ownerSelector'" disabled="isOpenManageAppMasterRoleLimit"></apollouserselector> <small style="color: maroon" ng-if="isOpenManageAppMasterRoleLimit">{{'App.AppOwnerTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">{{'Common.AppAdmin' | translate }}<br> </label> <div class="col-sm-9 J_adminSelectorPanel"> <apollomultipleuserselector apollo-id="'adminSelector'" ng-disabled="isOpenManageAppMasterRoleLimit"></apollomultipleuserselector> <br> <small>{{'App.AppAdminTips1' | translate }}</small> <br> <small>{{'App.AppAdminTips2' | translate }}</small> </div> </div> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} </button> </div> </div> </form> </div> </div> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/lodash.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="scripts/services/SystemRoleService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/AppController.js"></script> <script src="scripts/valdr.js" type="text/javascript"></script> </body> </html>
<!doctype html> <html ng-app="create_app"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'App.CreateProject' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel"> <header class="panel-heading"> {{'App.CreateProject' | translate }} </header> <form class="form-horizontal panel-body" name="appForm" ng-controller="CreateAppController" valdr-type="App" ng-submit="create()"> <div class="form-group"> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.Department' | translate }}</label> <div class="col-sm-3"> <select id="organization"> <option></option> </select> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }}</label> <div class="col-sm-3"> <input type="text" class="form-control" name="appId" ng-model="app.appId"> <small>{{'App.AppIdTips' | translate }} </small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppName' | translate }}</label> <div class="col-sm-5"> <input type="text" class="form-control" name="appName" ng-model="app.name"> <small>{{'App.AppNameTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppOwnerLong' | translate }}</label> <div class="col-sm-6 J_ownerSelectorPanel"> <apollouserselector apollo-id="'ownerSelector'" disabled="isOpenManageAppMasterRoleLimit"></apollouserselector> <small style="color: maroon" ng-if="isOpenManageAppMasterRoleLimit">{{'App.AppOwnerTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">{{'Common.AppAdmin' | translate }}<br> </label> <div class="col-sm-9 J_adminSelectorPanel"> <apollomultipleuserselector apollo-id="'adminSelector'" ng-disabled="isOpenManageAppMasterRoleLimit"></apollomultipleuserselector> <br> <small>{{'App.AppAdminTips1' | translate }}</small> <br> <small>{{'App.AppAdminTips2' | translate }}</small> </div> </div> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} </button> </div> </div> </form> </div> </div> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/lodash.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="scripts/services/SystemRoleService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/AppController.js"></script> <script src="scripts/valdr.js" type="text/javascript"></script> </body> </html>
1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/index.html
<!doctype html> <html ng-app="index"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'Common.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div id="app-list" class="hidden" ng-controller="IndexController"> <section class="media create-app-list"> <aside class="media-left text-center"> <h5>{{'Index.MyProject' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()" ng-if="hasCreateApplicationPermission"> <div href="#" class="thumbnail create-btn hover cursor-pointer"> <img src="img/plus-white.png" /> <h5>{{'Index.CreateProject' | translate }}</h5> </div> </div> <div class="app-panel col-md-2 text-center" ng-repeat="app in createdApps" ng-click="goToAppHomePage(app.appId)"> <div href="#" class="thumbnail hover cursor-pointer"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> </div> </div> <div class="app-panel col-md-2 text-center" ng-show="hasMoreCreatedApps" ng-click="getUserCreatedApps()"> <div href="#" class="thumbnail hover cursor-pointer"> <img class="more-img" src="img/more.png" /> <h5>{{'Index.LoadMore' | translate }}</h5> </div> </div> </aside> </section> <section class="media favorites-app-list"> <aside class="media-left text-center"> <h5>{{'Index.FavoriteItems' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-repeat="app in favorites" ng-click="goToAppHomePage(app.appId)" ng-mouseover="toggleOperationBtn(app)" ng-mouseout="toggleOperationBtn(app)"> <div class="thumbnail hover"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> <p class="operate-panel" ng-show="app.showOperationBtn"> <button class="btn btn-default btn-xs" title="{{'Index.Topping' | translate }}" ng-click="toTop(app.favoriteId);$event.stopPropagation();"> <img src="img/top.png" class="i-15"> </button> <button class="btn btn-default btn-xs" title="{{'Index.FavoriteCancel' | translate }}" ng-click="deleteFavorite(app.favoriteId);$event.stopPropagation();"> <img src="img/like.png" class="i-15"> </button> </p> </div> </div> <div class="col-md-2 text-center" ng-show="hasMoreFavorites" ng-click="getUserFavorites()"> <div href="#" class="thumbnail hover cursor-pointer"> <img class="more-img" src="img/more.png" /> <h5>{{'Index.LoadMore' | translate }}</h5> </div> </div> <div class="no-favorites text-center" ng-show="!favorites || favorites.length == 0"> <h4>{{'Index.FavoriteTip' | translate }}</h4> </div> </aside> </section> <section class="media visit-app-list" ng-show="visitedApps && visitedApps.length"> <aside class="media-left text-center"> <h5>{{'Index.RecentlyViewedItems' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-repeat="app in visitedApps" ng-click="goToAppHomePage(app.appId)"> <div class="thumbnail hover"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> </div> </div> </aside> </section> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/FavoriteService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/IndexController.js"></script> </body> </html>
<!doctype html> <html ng-app="index"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'Common.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div id="app-list" class="hidden" ng-controller="IndexController"> <section class="media create-app-list"> <aside class="media-left text-center"> <h5>{{'Index.MyProject' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()" ng-if="hasCreateApplicationPermission"> <div href="#" class="thumbnail create-btn hover cursor-pointer"> <img src="img/plus-white.png" /> <h5>{{'Index.CreateProject' | translate }}</h5> </div> </div> <div class="app-panel col-md-2 text-center" ng-repeat="app in createdApps" ng-click="goToAppHomePage(app.appId)"> <div href="#" class="thumbnail hover cursor-pointer"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> </div> </div> <div class="app-panel col-md-2 text-center" ng-show="hasMoreCreatedApps" ng-click="getUserCreatedApps()"> <div href="#" class="thumbnail hover cursor-pointer"> <img class="more-img" src="img/more.png" /> <h5>{{'Index.LoadMore' | translate }}</h5> </div> </div> </aside> </section> <section class="media favorites-app-list"> <aside class="media-left text-center"> <h5>{{'Index.FavoriteItems' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-repeat="app in favorites" ng-click="goToAppHomePage(app.appId)" ng-mouseover="toggleOperationBtn(app)" ng-mouseout="toggleOperationBtn(app)"> <div class="thumbnail hover"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> <p class="operate-panel" ng-show="app.showOperationBtn"> <button class="btn btn-default btn-xs" title="{{'Index.Topping' | translate }}" ng-click="toTop(app.favoriteId);$event.stopPropagation();"> <img src="img/top.png" class="i-15"> </button> <button class="btn btn-default btn-xs" title="{{'Index.FavoriteCancel' | translate }}" ng-click="deleteFavorite(app.favoriteId);$event.stopPropagation();"> <img src="img/like.png" class="i-15"> </button> </p> </div> </div> <div class="col-md-2 text-center" ng-show="hasMoreFavorites" ng-click="getUserFavorites()"> <div href="#" class="thumbnail hover cursor-pointer"> <img class="more-img" src="img/more.png" /> <h5>{{'Index.LoadMore' | translate }}</h5> </div> </div> <div class="no-favorites text-center" ng-show="!favorites || favorites.length == 0"> <h4>{{'Index.FavoriteTip' | translate }}</h4> </div> </aside> </section> <section class="media visit-app-list" ng-show="visitedApps && visitedApps.length"> <aside class="media-left text-center"> <h5>{{'Index.RecentlyViewedItems' | translate }}</h5> </aside> <aside class="media-body"> <div class="app-panel col-md-2 text-center" ng-repeat="app in visitedApps" ng-click="goToAppHomePage(app.appId)"> <div class="thumbnail hover"> <h4 ng-bind="app.appId"></h4> <h5 ng-bind="app.name"></h5> </div> </div> </aside> </section> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script type="application/javascript"> function getPrefixPath() { $.ajax({ method: 'get', async: false, url: 'prefix-path', success: function (res) { window.localStorage.setItem("prefixPath", res); } }) } getPrefixPath(); </script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/FavoriteService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/IndexController.js"></script> </body> </html>
1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/login.html
<!DOCTYPE html> <html lang="en" ng-app="login"> <head> <meta charset="UTF-8"> <title>{{ 'Common.Title' | translate }}</title> <link rel="icon" href="./img/config.png"> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="vendor/font-awesome.min.css"> <style type="text/css"> body { padding-top: 90px; background: #F7F7F7; color: #666666; font-family: 'Roboto', sans-serif; font-weight: 100; } body { width: 100%; background: -webkit-linear-gradient(left, #22d686, #24d3d3, #22d686, #24d3d3); background: linear-gradient(to right, #22d686, #24d3d3, #22d686, #24d3d3); background-size: 600% 100%; } .panel { border-radius: 5px; } label { font-weight: 300; } .panel-login { border: none; -webkit-box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); -moz-box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); } .panel-login .checkbox input[type=checkbox] { margin-left: 0px; } .panel-login .checkbox label { padding-left: 25px; font-weight: 300; display: inline-block; position: relative; } .panel-login .checkbox { padding-left: 20px; } .panel-login .checkbox label::before { content: ""; display: inline-block; position: absolute; width: 17px; height: 17px; left: 0; margin-left: 0px; border: 1px solid #cccccc; border-radius: 3px; background-color: #fff; -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; transition: border 0.15s ease-in-out, color 0.15s ease-in-out; } .panel-login .checkbox label::after { display: inline-block; position: absolute; width: 16px; height: 16px; left: 0; top: 0; margin-left: 0px; padding-left: 3px; padding-top: 1px; font-size: 11px; color: #555555; } .panel-login .checkbox input[type="checkbox"] { opacity: 0; } .panel-login .checkbox input[type="checkbox"]:focus + label::before { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .panel-login .checkbox input[type="checkbox"]:checked + label::after { font-family: 'FontAwesome'; content: "\f00c"; } .panel-login > .panel-heading .tabs { padding: 0; } .panel-login h2 { font-size: 20px; font-weight: 300; margin: 30px; } .panel-login > .panel-heading { color: #848c9d; background-color: #e8e9ec; border-color: #fff; text-align: center; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom: 0px; padding: 0px 15px; } .panel-login .form-group { padding: 0 30px; } .panel-login > .panel-heading .login { padding: 20px 30px; border-bottom-leftt-radius: 5px; } .panel-login > .panel-heading .register { padding: 20px 30px; background: #2d3b55; border-bottom-right-radius: 5px; } .panel-login > .panel-heading a { text-decoration: none; color: #666; font-weight: 300; font-size: 16px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; } .panel-login > .panel-heading a#register-form-link { color: #fff; width: 100%; text-align: right; } .panel-login > .panel-heading a#login-form-link { width: 100%; text-align: left; } .panel-login input[type="text"], .panel-login input[type="email"], .panel-login input[type="password"] { height: 45px; border: 0; font-size: 16px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; -webkit-box-shadow: none; box-shadow: none; border-bottom: 1px solid #e7e7e7; border-radius: 0px; padding: 6px 0px; } .panel-login input:hover, .panel-login input:focus { outline: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; border-color: #ccc; } .btn-login { background-color: #E8E9EC; outline: none; color: #2D3B55; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border: none; border-radius: 0px; box-shadow: none; } .btn-login:hover, .btn-login:focus { color: #fff; background-color: #2D3B55; } .forgot-password { text-decoration: underline; color: #888; } .forgot-password:hover, .forgot-password:focus { text-decoration: underline; color: #666; } .btn-register { background-color: #E8E9EC; outline: none; color: #2D3B55; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border: none; border-radius: 0px; box-shadow: none; } .btn-register:hover, .btn-register:focus { color: #fff; background-color: #2D3B55; } </style> </head> <body> <div class="container" ng-controller="LoginController"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="panel panel-login"> <div class="panel-body"> <div class="row"> <div class="col-lg-12"> <form id="login-form" action="signin" method="post" role="form" style="display: block;"> <p class="text-center"><img src="img/logo-detail.png" style="width: 500px;"></p> <div class="form-group"> <input type="text" name="username" tabindex="1" class="form-control" placeholder="Username" value=""> </div> <div class="form-group"> <input type="password" name="password" tabindex="2" class="form-control" placeholder="Password"> </div> <div class="form-group" style="color: red"> <small ng-bind="info"></small> </div> <div class="col-xs-12 form-group pull-right"> <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="{{'Login.Login' | translate }}"> </div> </form> </div> </div> </div> </div> </div> </div> </div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/LoginController.js"></script> <script type="application/javascript"> $(function () { $('#login-form-link').click(function (e) { $("#login-form").delay(100).fadeIn(100); $("#register-form").fadeOut(100); $('#register-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); $('#register-form-link').click(function (e) { $("#register-form").delay(100).fadeIn(100); $("#login-form").fadeOut(100); $('#login-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); $.get("prefix-path", function(result){ window.localStorage.setItem("prefixPath",result); }); }); </script> </body> </html>
<!DOCTYPE html> <html lang="en" ng-app="login"> <head> <meta charset="UTF-8"> <title>{{ 'Common.Title' | translate }}</title> <link rel="icon" href="./img/config.png"> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="vendor/font-awesome.min.css"> <style type="text/css"> body { padding-top: 90px; background: #F7F7F7; color: #666666; font-family: 'Roboto', sans-serif; font-weight: 100; } body { width: 100%; background: -webkit-linear-gradient(left, #22d686, #24d3d3, #22d686, #24d3d3); background: linear-gradient(to right, #22d686, #24d3d3, #22d686, #24d3d3); background-size: 600% 100%; } .panel { border-radius: 5px; } label { font-weight: 300; } .panel-login { border: none; -webkit-box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); -moz-box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); box-shadow: 0px 0px 49px 14px rgba(188, 190, 194, 0.39); } .panel-login .checkbox input[type=checkbox] { margin-left: 0px; } .panel-login .checkbox label { padding-left: 25px; font-weight: 300; display: inline-block; position: relative; } .panel-login .checkbox { padding-left: 20px; } .panel-login .checkbox label::before { content: ""; display: inline-block; position: absolute; width: 17px; height: 17px; left: 0; margin-left: 0px; border: 1px solid #cccccc; border-radius: 3px; background-color: #fff; -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; transition: border 0.15s ease-in-out, color 0.15s ease-in-out; } .panel-login .checkbox label::after { display: inline-block; position: absolute; width: 16px; height: 16px; left: 0; top: 0; margin-left: 0px; padding-left: 3px; padding-top: 1px; font-size: 11px; color: #555555; } .panel-login .checkbox input[type="checkbox"] { opacity: 0; } .panel-login .checkbox input[type="checkbox"]:focus + label::before { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; } .panel-login .checkbox input[type="checkbox"]:checked + label::after { font-family: 'FontAwesome'; content: "\f00c"; } .panel-login > .panel-heading .tabs { padding: 0; } .panel-login h2 { font-size: 20px; font-weight: 300; margin: 30px; } .panel-login > .panel-heading { color: #848c9d; background-color: #e8e9ec; border-color: #fff; text-align: center; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom: 0px; padding: 0px 15px; } .panel-login .form-group { padding: 0 30px; } .panel-login > .panel-heading .login { padding: 20px 30px; border-bottom-leftt-radius: 5px; } .panel-login > .panel-heading .register { padding: 20px 30px; background: #2d3b55; border-bottom-right-radius: 5px; } .panel-login > .panel-heading a { text-decoration: none; color: #666; font-weight: 300; font-size: 16px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; } .panel-login > .panel-heading a#register-form-link { color: #fff; width: 100%; text-align: right; } .panel-login > .panel-heading a#login-form-link { width: 100%; text-align: left; } .panel-login input[type="text"], .panel-login input[type="email"], .panel-login input[type="password"] { height: 45px; border: 0; font-size: 16px; -webkit-transition: all 0.1s linear; -moz-transition: all 0.1s linear; transition: all 0.1s linear; -webkit-box-shadow: none; box-shadow: none; border-bottom: 1px solid #e7e7e7; border-radius: 0px; padding: 6px 0px; } .panel-login input:hover, .panel-login input:focus { outline: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; border-color: #ccc; } .btn-login { background-color: #E8E9EC; outline: none; color: #2D3B55; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border: none; border-radius: 0px; box-shadow: none; } .btn-login:hover, .btn-login:focus { color: #fff; background-color: #2D3B55; } .forgot-password { text-decoration: underline; color: #888; } .forgot-password:hover, .forgot-password:focus { text-decoration: underline; color: #666; } .btn-register { background-color: #E8E9EC; outline: none; color: #2D3B55; font-size: 14px; height: auto; font-weight: normal; padding: 14px 0; text-transform: uppercase; border: none; border-radius: 0px; box-shadow: none; } .btn-register:hover, .btn-register:focus { color: #fff; background-color: #2D3B55; } </style> </head> <body> <div class="container" ng-controller="LoginController"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="panel panel-login"> <div class="panel-body"> <div class="row"> <div class="col-lg-12"> <form id="login-form" action="signin" method="post" role="form" style="display: block;"> <p class="text-center"><img src="img/logo-detail.png" style="width: 500px;"></p> <div class="form-group"> <input type="text" name="username" tabindex="1" class="form-control" placeholder="Username" value=""> </div> <div class="form-group"> <input type="password" name="password" tabindex="2" class="form-control" placeholder="Password"> </div> <div class="form-group" style="color: red"> <small ng-bind="info"></small> </div> <div class="col-xs-12 form-group pull-right"> <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="{{'Login.Login' | translate }}"> </div> </form> </div> </div> </div> </div> </div> </div> </div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <script type="application/javascript"> function getPrefixPath() { $.ajax({ method: 'get', async: false, url: 'prefix-path', success: function (res) { window.localStorage.setItem("prefixPath", res); } }) } getPrefixPath(); </script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/controller/LoginController.js"></script> <script type="application/javascript"> $(function () { $('#login-form-link').click(function (e) { $("#login-form").delay(100).fadeIn(100); $("#register-form").fadeOut(100); $('#register-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); $('#register-form-link').click(function (e) { $("#register-form").delay(100).fadeIn(100); $("#login-form").fadeOut(100); $('#login-form-link').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); }); </script> </body> </html>
1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/gray-release-rules-modal.html
<form id="rulesModal" class="modal fade" role="dialog" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button> <h4 class="modal-title"> {{'Component.GrayscalePublishRule.Title' | translate }} </h4> </div> <div class="modal-body form-horizontal"> <div class="form-group" ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <label class="control-label col-md-3 text-right"> <apollorequiredfield></apollorequiredfield> {{'Component.GrayscalePublishRule.AppId' | translate }} </label> <div class="col-md-4"> <input type="text" class="form-control" ng-model="branch.editingRuleItem.clientAppId" ng-model-options='{ debounce: 300 }' ng-change='initSelectIps()'> </div> </div> <div class="form-group" ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <label class="control-label col-md-3 text-right">{{'Component.GrayscalePublishRule.AcceptRule' | translate }}</label> <div class="col-md-9"> <label class="form-control-static radio-inline"> <input type="radio" name="ApplyToAllInstances" value="false" ng-checked="!branch.editingRuleItem.ApplyToAllInstances" ng-click="branch.editingRuleItem.ApplyToAllInstances = false"> {{'Component.GrayscalePublishRule.AcceptPartInstance' | translate }} </label> <label class="form-control-static radio-inline"> <input type="radio" name="ApplyToAllInstances" value="true" ng-checked="branch.editingRuleItem.ApplyToAllInstances" ng-click="branch.editingRuleItem.ApplyToAllInstances = true"> {{'Component.GrayscalePublishRule.AcceptAllInstance' | translate }} </label> </div> </div> <div class="form-group" ng-show="!branch.editingRuleItem.ApplyToAllInstances"> <label class="control-label col-md-3 text-right"> <apollorequiredfield></apollorequiredfield> {{'Component.GrayscalePublishRule.IP' | translate }} </label> <div class="col-md-9"> <div class="form-inline"> <div class="form-group"> <select class="rules-ip-selector" multiple="multiple"> <option ng-repeat="instance in selectIps" ng-bind="instance.ip"> </option> </select> <div ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <small>{{'Component.GrayscalePublishRule.AppIdFilterTips' | translate }}</small> </div> <div style="margin-top: 5px"> <small>{{'Component.GrayscalePublishRule.IpTips' | translate }}<a ng-click="manual =! manual">{{'Component.GrayscalePublishRule.EnterIp' | translate }}</a></small> </div> </div> </div> <div class="form-inline" ng-show="manual"> <div class="form-group"> <textarea class="form-control" ng-model="toAddIPs" rows="3" placeholder="{{'Component.GrayscalePublishRule.EnterIpTips' | translate }}"></textarea> </div> <button class="btn-default btn add-rule" ng-click="batchAddIPs(branch, toAddIPs)"> {{'Component.GrayscalePublishRule.Add' | translate }} </button> </div> </div> </div> <div class="form-group" ng-show="!branch.editingRuleItem.ApplyToAllInstances"> <div class="col-md-offset-1 col-md-10 item-container"> <section class="btn-group item-info" ng-repeat="ip in branch.editingRuleItem.draftIpList"> <button type="button" class="btn btn-default" ng-bind="ip"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" ng-click="removeRule(branch.editingRuleItem, ip)"> <span class="glyphicon glyphicon-remove"></span> </button> </section> </div> </div> </div> <div class="modal-footer"> <button class="btn btn-default" ng-click="cancelEditItem(branch)">{{'Common.Cancel' | translate }}</button> <button class="btn btn-primary" ng-disabled="completeEditBtnDisable" ng-click="completeEditItem(branch)">{{'Common.Ok' | translate }} </button> </div> </div> </div> </form>
<form id="rulesModal" class="modal fade" role="dialog" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button> <h4 class="modal-title"> {{'Component.GrayscalePublishRule.Title' | translate }} </h4> </div> <div class="modal-body form-horizontal"> <div class="form-group" ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <label class="control-label col-md-3 text-right"> <apollorequiredfield></apollorequiredfield> {{'Component.GrayscalePublishRule.AppId' | translate }} </label> <div class="col-md-4"> <input type="text" class="form-control" ng-model="branch.editingRuleItem.clientAppId" ng-model-options='{ debounce: 300 }' ng-change='initSelectIps()'> </div> </div> <div class="form-group" ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <label class="control-label col-md-3 text-right">{{'Component.GrayscalePublishRule.AcceptRule' | translate }}</label> <div class="col-md-9"> <label class="form-control-static radio-inline"> <input type="radio" name="ApplyToAllInstances" value="false" ng-checked="!branch.editingRuleItem.ApplyToAllInstances" ng-click="branch.editingRuleItem.ApplyToAllInstances = false"> {{'Component.GrayscalePublishRule.AcceptPartInstance' | translate }} </label> <label class="form-control-static radio-inline"> <input type="radio" name="ApplyToAllInstances" value="true" ng-checked="branch.editingRuleItem.ApplyToAllInstances" ng-click="branch.editingRuleItem.ApplyToAllInstances = true"> {{'Component.GrayscalePublishRule.AcceptAllInstance' | translate }} </label> </div> </div> <div class="form-group" ng-show="!branch.editingRuleItem.ApplyToAllInstances"> <label class="control-label col-md-3 text-right"> <apollorequiredfield></apollorequiredfield> {{'Component.GrayscalePublishRule.IP' | translate }} </label> <div class="col-md-9"> <div class="form-inline"> <div class="form-group"> <select class="rules-ip-selector" multiple="multiple"> <option ng-repeat="instance in selectIps" ng-bind="instance.ip"> </option> </select> <div ng-show="branch.parentNamespace.isPublic && !branch.parentNamespace.isLinkedNamespace"> <small>{{'Component.GrayscalePublishRule.AppIdFilterTips' | translate }}</small> </div> <div style="margin-top: 5px"> <small>{{'Component.GrayscalePublishRule.IpTips' | translate }}<a ng-click="manual =! manual">{{'Component.GrayscalePublishRule.EnterIp' | translate }}</a></small> </div> </div> </div> <div class="form-inline" ng-show="manual"> <div class="form-group"> <textarea class="form-control" ng-model="toAddIPs" rows="3" placeholder="{{'Component.GrayscalePublishRule.EnterIpTips' | translate }}"></textarea> </div> <button class="btn-default btn add-rule" ng-click="batchAddIPs(branch, toAddIPs)"> {{'Component.GrayscalePublishRule.Add' | translate }} </button> </div> </div> </div> <div class="form-group" ng-show="!branch.editingRuleItem.ApplyToAllInstances"> <div class="col-md-offset-1 col-md-10 item-container"> <section class="btn-group item-info" ng-repeat="ip in branch.editingRuleItem.draftIpList"> <button type="button" class="btn btn-default" ng-bind="ip"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" ng-click="removeRule(branch.editingRuleItem, ip)"> <span class="glyphicon glyphicon-remove"></span> </button> </section> </div> </div> </div> <div class="modal-footer"> <button class="btn btn-default" ng-click="cancelEditItem(branch)">{{'Common.Cancel' | translate }}</button> <button class="btn btn-primary" ng-disabled="completeEditBtnDisable" ng-click="completeEditItem(branch)">{{'Common.Ok' | translate }} </button> </div> </div> </div> </form>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/open/manage.html
<!doctype html> <html ng-app="open_manage"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Open.Manage.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid" ng-controller="OpenManageController"> <div class="col-md-10 col-md-offset-1 panel"> <section class="panel-body" ng-show="isRootUser"> <!--project admin--> <section class="row"> <h5>{{'Open.Manage.CreateThirdApp' | translate }} <small> {{'Open.Manage.CreateThirdAppTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ThirdAppId' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumer.appId"> <small>{{'Open.Manage.ThirdAppIdTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getTokenByAppId()">查询</button> </div> <div class="col-sm-6"> <h4 style="color: red" ng-show="consumerToken" ng-bind="'Token: ' + consumerToken.token"></h4> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.Department' | translate }} </label> <div class="col-sm-3"> <select id="organization"> <option></option> </select> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ThirdAppName' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumer.name"> <small>{{'Open.Manage.ThirdAppNameTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ProjectOwner' | translate }} </label> <div class="col-sm-6 J_ownerSelectorPanel"> <apollouserselector apollo-id="'ownerSelector'"></apollouserselector> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="submitBtnDisabled" ng-click="createConsumer()"> {{'Open.Manage.Create' | translate }} </button> </div> </div> </form> </section> <section class="row"> <h5>{{'Open.Manage.GrantPermission' | translate }} <small> {{'Open.Manage.GrantPermissionTips' | translate }} </small> </h5> <hr> <form class="form-horizontal" ng-submit="assignRoleToConsumer()"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.Token' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="consumerRole.token" required> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ManagedAppId' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumerRole.appId" required> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Open.Manage.ManagedNamespace' | translate }}</label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumerRole.namespaceName"> <small>{{'Open.Manage.ManagedNamespaceTips' | translate }}</small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Open.Manage.GrantType' | translate }} </label> <div class="col-sm-3"> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" ng-value="'NamespaceRole'" ng-model="consumerRole.type"> {{'Open.Manage.GrantType.Namespace' | translate }} </label> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" ng-value="'AppRole'" ng-model="consumerRole.type"> {{'Open.Manage.GrantType.App' | translate }} </label> </div> </div> <div class="form-group" valdr-form-group ng-show="consumerRole.type=='NamespaceRole'"> <label class="col-sm-2 control-label"> {{'Open.Manage.GrantEnv' | translate }} </label> <div class="col-sm-10"> <div> <label class="checkbox-inline" ng-repeat="env in envs"> <input type="checkbox" ng-checked="env.checked" ng-click="switchSelect(env)" /> {{env.env}} </label> </div> <small>{{'Open.Manage.GrantEnvTips' | translate }}</small> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="submitBtnDisabled"> {{'Common.Submit' | translate }} </button> </div> </div> </form> </section> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-route.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="../vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="../vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/lodash.min.js"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="../scripts/services/ConsumerService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/valdr.js"></script> <script type="application/javascript" src="../scripts/controller/open/OpenManageController.js"></script> </body> </html>
<!doctype html> <html ng-app="open_manage"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Open.Manage.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid" ng-controller="OpenManageController"> <div class="col-md-10 col-md-offset-1 panel"> <section class="panel-body" ng-show="isRootUser"> <!--project admin--> <section class="row"> <h5>{{'Open.Manage.CreateThirdApp' | translate }} <small> {{'Open.Manage.CreateThirdAppTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ThirdAppId' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumer.appId"> <small>{{'Open.Manage.ThirdAppIdTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getTokenByAppId()">查询</button> </div> <div class="col-sm-6"> <h4 style="color: red" ng-show="consumerToken" ng-bind="'Token: ' + consumerToken.token"></h4> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.Department' | translate }} </label> <div class="col-sm-3"> <select id="organization"> <option></option> </select> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ThirdAppName' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumer.name"> <small>{{'Open.Manage.ThirdAppNameTips' | translate }}</small> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ProjectOwner' | translate }} </label> <div class="col-sm-6 J_ownerSelectorPanel"> <apollouserselector apollo-id="'ownerSelector'"></apollouserselector> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="submitBtnDisabled" ng-click="createConsumer()"> {{'Open.Manage.Create' | translate }} </button> </div> </div> </form> </section> <section class="row"> <h5>{{'Open.Manage.GrantPermission' | translate }} <small> {{'Open.Manage.GrantPermissionTips' | translate }} </small> </h5> <hr> <form class="form-horizontal" ng-submit="assignRoleToConsumer()"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.Token' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="consumerRole.token" required> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Open.Manage.ManagedAppId' | translate }} </label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumerRole.appId" required> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Open.Manage.ManagedNamespace' | translate }}</label> <div class="col-sm-3"> <input type="text" class="form-control" ng-model="consumerRole.namespaceName"> <small>{{'Open.Manage.ManagedNamespaceTips' | translate }}</small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Open.Manage.GrantType' | translate }} </label> <div class="col-sm-3"> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" ng-value="'NamespaceRole'" ng-model="consumerRole.type"> {{'Open.Manage.GrantType.Namespace' | translate }} </label> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" ng-value="'AppRole'" ng-model="consumerRole.type"> {{'Open.Manage.GrantType.App' | translate }} </label> </div> </div> <div class="form-group" valdr-form-group ng-show="consumerRole.type=='NamespaceRole'"> <label class="col-sm-2 control-label"> {{'Open.Manage.GrantEnv' | translate }} </label> <div class="col-sm-10"> <div> <label class="checkbox-inline" ng-repeat="env in envs"> <input type="checkbox" ng-checked="env.checked" ng-click="switchSelect(env)" /> {{env.env}} </label> </div> <small>{{'Open.Manage.GrantEnvTips' | translate }}</small> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="submitBtnDisabled"> {{'Common.Submit' | translate }} </button> </div> </div> </form> </section> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-route.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="../vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="../vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/lodash.min.js"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="../scripts/services/ConsumerService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/valdr.js"></script> <script type="application/javascript" src="../scripts/controller/open/OpenManageController.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html
<!--master panel body when not initialized--> <section class="master-panel-body" ng-if="!namespace.initialized"> <!--main header--> <header class="panel-heading"> <div class="row"> <div class="col-md-6 col-sm-6 header-namespace"> <b class="namespace-name" ng-bind="namespace.viewName" data-tooltip="tooltip" data-placement="bottom" title="{{namespace.comment}}"></b> <span class="label label-warning no-radius namespace-label modify-tip" ng-show="namespace.itemModifiedCnt > 0"> {{'Component.Namespace.Master.Items.Changed' | translate }} <span class="badge label badge-white namespace-label" ng-bind="namespace.itemModifiedCnt"></span> </span> </div> <div class="col-md-6 col-sm-6 text-right header-buttons"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.LoadNamespaceTips' | translate }}" ng-click="refreshNamespace()"> <img src="img/more.png"> {{'Component.Namespace.Master.LoadNamespace' | translate }} </button> </div> </div> </header> </section> <!--master panel body--> <section class="master-panel-body" ng-if="namespace.initialized && (namespace.hasBranch && namespace.displayControl.currentOperateBranch == 'master' || !namespace.hasBranch)"> <!--main header--> <header class="panel-heading"> <div class="row"> <div class="col-md-6 col-sm-6 header-namespace"> <b class="namespace-name" ng-bind="namespace.viewName" data-tooltip="tooltip" data-placement="bottom" title="{{namespace.comment}}"></b> <span class="label label-warning no-radius namespace-label modify-tip" ng-show="namespace.itemModifiedCnt > 0"> {{'Component.Namespace.Master.Items.Changed' | translate }} <span class="badge label badge-white namespace-label" ng-bind="namespace.itemModifiedCnt"></span> </span> <span class="label label-primary no-radius namespace-label" ng-show="namespace.lockOwner">{{'Component.Namespace.Master.Items.ChangedUser' | translate }}:{{namespace.lockOwner}}</span> </div> <div class="col-md-6 col-sm-6 text-right header-buttons"> <button type="button" class="btn btn-success btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.PublishTips' | translate }}" ng-show="(namespace.hasReleasePermission || namespace.hasModifyPermission)" ng-disabled="namespace.isTextEditing" ng-click="publish(namespace)"> <img src="img/release.png"> {{'Component.Namespace.Master.Items.Publish' | translate }} </button> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RollbackTips' | translate }}" ng-show="namespace.hasReleasePermission" ng-click="rollback(namespace)"> <img src="img/rollback.png"> {{'Component.Namespace.Master.Items.Rollback' | translate }} </button> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.PublishHistoryTips' | translate }}" href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}"> <img src="img/release-history.png"> {{'Component.Namespace.Master.Items.PublishHistory' | translate }} </a> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrantTips' | translate }}" href="{{ '/namespace/role.html' | prefixPath }}?#/appid={{appId}}&namespaceName={{namespace.baseInfo.namespaceName}}" ng-show="hasAssignUserPermission"> <img src="img/assign.png"> {{'Component.Namespace.Master.Items.Grant' | translate }} </a> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrayscaleTips' | translate }}" ng-show="!namespace.hasBranch && namespace.isPropertiesFormat && namespace.hasModifyPermission" ng-click="preCreateBranch(namespace)"> <img src="img/test.png"> {{'Component.Namespace.Master.Items.Grayscale' | translate }} </a> <a type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RequestPermissionTips' | translate }}" ng-click="showNoModifyPermissionDialog()" ng-show="!namespace.hasModifyPermission && !namespace.hasReleasePermission"> {{'Component.Namespace.Master.Items.RequestPermission' | translate }} </a> <div class="btn-group" ng-show="namespace.hasModifyPermission || namespace.hasReleasePermission || hasAssignUserPermission"> <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <img src="img/operate.png"> <span class="caret"></span> </button> <ul class="dropdown-menu" style="right: 0; left: -160px;"> <li ng-click="deleteNamespace(namespace)"> <a style="color: red"> <img src="img/delete.png"> {{'Component.Namespace.Master.Items.DeleteNamespace' | translate }}</a> </li> </ul> </div> </div> </div> </header> <div id="BODY{{namespace.id}}" ng-class="{'collapse in': showNamespaceBody, 'collapse' : !showNamespaceBody}"> <div class="J_namespace-release-tip well well-sm no-radius text-center" ng-show="namespace.isConfigHidden"> <span style="color: red">{{'Component.Namespace.Master.Items.NoPermissionTips' | translate }}</span> </div> <!--second header--> <header class="panel-heading second-panel-heading" ng-show="!namespace.isConfigHidden"> <div class="row"> <div class="col-md-6 col-sm-6 pull-left"> <!--master branch nav tabs--> <ul class="nav nav-tabs"> <li role="presentation" ng-click="switchView(namespace, 'table')" ng-show="namespace.isPropertiesFormat"> <a ng-class="{node_active:namespace.viewType == 'table'}"> <img src="img/table.png"> {{'Component.Namespace.Master.Items.ItemList' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'text')"> <a ng-class="{node_active:namespace.viewType == 'text'}"> <img src="img/text.png"> {{'Component.Namespace.Master.Items.ItemListByText' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'history')"> <a ng-class="{node_active:namespace.viewType == 'history'}"> <img src="img/change.png"> {{'Component.Namespace.Master.Items.ItemHistory' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'instance')"> <a ng-class="{node_active:namespace.viewType == 'instance'}"> <img src="img/machine.png"> {{'Component.Namespace.Master.Items.ItemInstance' | translate }} <span class="badge badge-grey" ng-bind="namespace.instancesCount"></span> </a> </li> </ul> </div> <div class="col-md-6 col-sm-6 text-right"> <img src="img/copy.png" class="ns_btn clipboard cursor-pointer" data-clipboard-text="{{namespace.text}}" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.CopyText' | translate }}" ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission"> <img src="img/syntax.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrammarCheck' | translate }}" ng-show="namespace.isTextEditing && namespace.viewType == 'text' && namespace.isSyntaxCheckable" ng-click="syntaxCheck(namespace)"> &nbsp; <img src="img/cancel.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.CancelChanged' | translate }}" ng-show="namespace.isTextEditing && namespace.viewType == 'text'" ng-click="toggleTextEditStatus(namespace)"> <img src="img/edit.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Change' | translate }}" ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission" ng-click="toggleTextEditStatus(namespace)"> &nbsp; <img src="img/submit.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SummitChanged' | translate }}" data-toggle="modal" data-target="#commitModal" ng-show="namespace.isTextEditing && namespace.viewType == 'text'" ng-click="modifyByText(namespace)"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SortByKey' | translate }}" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && !namespace.isLinkedNamespace" ng-click="toggleItemSearchInput(namespace)"> <span class="glyphicon glyphicon-filter"></span> {{'Component.Namespace.Master.Items.FilterItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SyncItemTips' | translate }}" ng-click="goToSyncPage(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission && namespace.isPropertiesFormat"> <img src="img/sync.png"> {{'Component.Namespace.Master.Items.SyncItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RevokeItemTips' | translate }}" ng-click="preRevokeItem(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission && namespace.isPropertiesFormat"> <img src="img/rollback.png"> {{'Component.Namespace.Master.Items.RevokeItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.DiffItemTips' | translate }}" ng-click="goToDiffPage(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.isPropertiesFormat"> <img src="img/diff.png"> {{'Component.Namespace.Master.Items.DiffItem' | translate }} </button> <button type="button" class="btn btn-primary btn-sm" ng-show="!namespace.isLinkedNamespace && namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission" ng-click="createItem(namespace)"> <img src="img/plus.png"> {{'Component.Namespace.Master.Items.AddItem' | translate }} </button> </div> </div> </header> <!--namespace body--> <section ng-show="!namespace.isConfigHidden"> <!--table view--> <div class="namespace-view-table" ng-show="namespace.viewType == 'table'"> <div class="J_namespace-release-tip well well-sm no-radius text-center" ng-show="namespace.isLatestReleaseLoaded && !namespace.isLinkedNamespace && !namespace.latestRelease"> <span style="color: red"> {{'Component.Namespace.Master.Items.Body.ItemsNoPublishedTips' | translate }}</span> </div> <!--not link namespace--> <div ng-if="!namespace.isLinkedNamespace"> <div class="search-input" ng-show="namespace.displayControl.showSearchInput"> <input type="text" class="form-control" placeholder="{{'Component.Namespace.Master.Items.Body.FilterByKey' | translate }}" ng-model="namespace.searchKey" ng-change="searchItems(namespace)"> </div> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.PublishState' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc" ng-if="config.item.key" ng-class="{'warning': !config.item.value}"> <td width="8%" class="text-center"> <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NoPublishTitle' | translate }}" ng-click="showText(config.oldValue?config.oldValue:('Component.Namespace.Master.Items.Body.NoPublishTips' | translate))">{{'Component.Namespace.Master.Items.Body.NoPublish' | translate }}</span> <span class="label label-default-light no-radius" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.PublishedTitle' | translate }}" ng-if="!config.isModified">{{'Component.Namespace.Master.Items.Body.Published' | translate }}</span> </td> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.HaveGrayscale' | translate }}" ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'">{{'Component.Namespace.Master.Items.Body.Grayscale' | translate }}</span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="30%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="13%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="16%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="8%" class="text-center" ng-if="!config.isDeleted"> <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifyTips' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> <img style="margin-left: 5px;" src="img/cancel.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeleteTips' | translate }}" ng-click="preDeleteItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> </div> <!--link namespace--> <div class="panel panel-default" ng-if="namespace.isLinkedNamespace"> <div class="panel-heading"> <div class="row"> <div class="padding-top-5 col-md-4 col-sm-4"> {{'Component.Namespace.Master.Items.Body.Link.Title' | translate }} </div> <div class="col-md-8 col-sm-8"> <input type="text" class="form-control pull-right" placeholder="filter by key ..." ng-class="{'search-onblur': namespace.searchStatus == 'OFF' || !namespace.searchStatus, 'search-focus': namespace.searchStatus == 'ON'}" ng-model="namespace.searchKey" ng-change="searchItems(namespace)" ng-focus="namespace.searchStatus='ON'" ng-blur="namespace.searchStatus='OFF'"> </div> </div> </div> <table class="table table-bordered table-striped table-hover" ng-if="namespace.viewItems && namespace.viewItems.length"> <thead> <tr> <th>{{'Component.Namespace.Master.Items.Body.PublishState' | translate }}</th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc" ng-if="config.item.key"> <td width="8%" class="text-center"> <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NoPublishTitle' | translate }}" ng-click="showText(config.oldValue?config.oldValue:('Component.Namespace.Master.Items.Body.NoPublishTips' | translate))">{{'Component.Namespace.Master.Items.Body.NoPublish' | translate }}</span> <span class="label label-default-light no-radius" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.PublishedTitle' | translate }}" ng-if="!config.isModified">{{'Component.Namespace.Master.Items.Body.Published' | translate }}</span> </td> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.HaveGrayscale' | translate }}" ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'">{{'Component.Namespace.Master.Items.Body.Grayscale' | translate }}</span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="30%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="13%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="16%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="8%" class="text-center" ng-if="!config.isDeleted"> <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifyTips' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> <img style="margin-left: 5px;" src="img/cancel.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeleteTips' | translate }}" ng-click="preDeleteItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="!namespace.viewItems || !namespace.viewItems.length"> <h5>{{'Component.Namespace.Master.Items.Body.Link.NoCoverLinkItem' | translate }}</h5> </div> </div> <!--link namespace's public namespace--> <div ng-if="namespace.isLinkedNamespace"> <div class="panel panel-default" ng-if="namespace.publicNamespace"> <div class="panel-heading"> <div class="row"> <div class="padding-top-5 col-md-4 col-sm-4"> {{'Component.Namespace.Master.Items.Body.Public.Title' | translate }} <a href="{{ '/config.html' | prefixPath }}?#/appid={{namespace.publicNamespace.baseInfo.appId}}&env={{env}}&cluster={{namespace.publicNamespace.baseInfo.clusterName}}" target="_blank"> <small> ({{'Common.AppId' | translate }}:{{namespace.publicNamespace.baseInfo.appId}}, {{'Common.Cluster' | translate }}:{{namespace.publicNamespace.baseInfo.clusterName}}) </small> </a> </div> <div class="col-md-4 col-sm-4 text-center"> <div class="btn-group btn-group-sm" role="group" ng-show="namespace.publicNamespace.isModified"> <button type="button" class="btn btn-default" ng-class="{'active':namespace.publicNamespaceViewType == 'RELEASE' || !namespace.publicNamespaceViewType}" ng-click="namespace.publicNamespaceViewType = 'RELEASE'"> {{'Component.Namespace.Master.Items.Body.Public.Published' | translate }} </button> <button type="button" class="btn btn-default" ng-class="{'active':namespace.publicNamespaceViewType == 'NOT_RELEASE'}" ng-click="namespace.publicNamespaceViewType = 'NOT_RELEASE'"> {{'Component.Namespace.Master.Items.Body.Public.NoPublish' | translate }} </button> </div> </div> <div class="col-md-4 col-sm-4"> <input type="text" class="form-control pull-right" placeholder="filter by key ..." ng-class="{'search-onblur': namespace.publicNamespace.searchStatus == 'OFF' || !namespace.publicNamespace.searchStatus, 'search-focus': namespace.publicNamespace.searchStatus == 'ON'}" ng-model="namespace.publicNamespace.searchKey" ng-change="searchItems(namespace.publicNamespace)" ng-blur="namespace.publicNamespace.searchStatus='OFF'" ng-focus="namespace.publicNamespace.searchStatus='ON'" /> </div> </div> </div> <!--published items--> <div ng-show="!namespace.publicNamespaceViewType || namespace.publicNamespaceViewType == 'RELEASE'"> <table class="table table-bordered table-striped table-hover" ng-show="namespace.publicNamespace.hasPublishedItem"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc" ng-if="config.item.key && !config.isModified && !config.isDeleted"> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> </td> <td width="35%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="15%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="10%" class="text-center" ng-if="!config.isDeleted"> <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Public.PublishedAndCover' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission && !config.covered"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="namespace.publicNamespace.viewItems && namespace.publicNamespace.viewItems.length && !namespace.publicNamespace.hasPublishedItem"> <h5>{{'Component.Namespace.Master.Items.Body.Public.NoPublished' | translate }}</h5> </div> </div> <!--not published items--> <table class="table table-bordered table-striped table-hover" ng-show="namespace.publicNamespaceViewType == 'NOT_RELEASE'"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.NoPublished.PublishedValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.NoPublished.NoPublishedValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc" ng-if="config.item.key && (config.isModified || config.isDeleted)"> <td width="20%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="25%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.oldValue)"> <span ng-bind="config.oldValue | limitTo: 250"></span> <span ng-bind="config.oldValue.length > 250 ? '...': ''"></span> </td> <td width="25%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="10%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="5%" class="text-center" ng-if="!config.isDeleted"> <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Public.PublishedAndCover' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission && !config.covered"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="!namespace.publicNamespace.viewItems || !namespace.publicNamespace.viewItems.length"> <h5>{{'Component.Namespace.Master.Items.Body.NoPublished.Title' | translate }}</h5> </div> </div> <div class="panel panel-default" ng-if="!namespace.publicNamespace"> <div class="panel-heading"> {{'Component.Namespace.Master.Items.Body.Public.Title' | translate }} </div> <div class="panel-body text-center"> {{'Component.Namespace.Master.Items.Body.Public.NoPublicNamespaceTips1' | translate }} <a href="{{ '/config.html' | prefixPath }}?#/appid={{namespace.parentAppId}}" target="_blank">{{namespace.parentAppId}}</a> {{'Component.Namespace.Master.Items.Body.Public.NoPublicNamespaceTips2' | translate:this }} </div> </div> </div> </div> <!--text view--> <!--只读模式下的文本内容,不替换换行符--> <div ui-ace="aceConfig" readonly="true" class="form-control no-radius" rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}" ng-show="namespace.viewType == 'text' && !namespace.isTextEditing" ng-model="namespace.text"> </div> <!--编辑状态下的文本内容,会过滤掉换行符--> <div ui-ace="aceConfig" class="form-control no-radius" rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}" ng-show="namespace.viewType == 'text' && namespace.isTextEditing" ng-disabled="!namespace.isTextEditing" ng-model="namespace.editText"> </div> <!--history view--> <div class="J_historyview history-view" ng-show="namespace.viewType == 'history'"> <div class="media" ng-show="namespace.commits && namespace.commits.length" ng-repeat="commits in namespace.commits"> <div class="media-body"> <div class="row"> <div class="col-md-6 col-sm-6"> <h3 class="media-heading" ng-bind="commits.dataChangeCreatedBy"></h3> </div> <div class="col-md-6 col-sm-6 text-right"> <h5 class="media-heading" ng-bind="commits.dataChangeCreatedTime | date: 'yyyy-MM-dd HH:mm:ss'"></h5> </div> </div> <!--properties format--> <table class="table table-bordered table-striped text-center table-hover" style="margin-top: 5px;" ng-if="namespace.isPropertiesFormat"> <thead> <tr> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemType' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemKey' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemOldValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemNewValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemComment' | translate }} </th> </tr> </thead> <tbody> <!--兼容老数据,不显示item类型为空行和注释的item--> <tr ng-repeat="item in commits.changeSets.createItems" ng-show="item.key"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.NewAdded' | translate }} </td> <td width="20%" title="{{item.key}}"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' :''"></span> </td> <td width="28%"> </td> <td width="28%" class="cursor-pointer" title="{{item.value}}" ng-click="showText(item.value)"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...': ''"></span> </td> <td width="18%" title="{{item.comment}}"> <span ng-bind="item.comment | limitTo: 250"></span> <span ng-bind="item.comment.length > 250 ?'...' : ''"></span> </td> </tr> <tr ng-repeat="item in commits.changeSets.updateItems"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.Updated' | translate }} </td> <td width="20%" title="{{item.newItem.key}}"> <span ng-bind="item.newItem.key | limitTo: 250"></span> <span ng-bind="item.newItem.key.length > 250 ? '...' :''"></span> </td> <td width="28%" class="cursor-pointer" title="{{item.oldItem.value}}" ng-click="showText(item.oldItem.value)"> <span ng-bind="item.oldItem.value | limitTo: 250"></span> <span ng-bind="item.oldItem.value.length > 250 ? '...': ''"></span> </td> <td width="28%" class="cursor-pointer" title="{{item.newItem.value}}" ng-click="showText(item.newItem.value)"> <span ng-bind="item.newItem.value | limitTo: 250"></span> <span ng-bind="item.newItem.value.length > 250 ? '...': ''"></span> </td> <td width="18%" title="{{item.newItem.comment}}"> <span ng-bind="item.newItem.comment | limitTo: 250"></span> <span ng-bind="item.newItem.comment.length > 250 ?'...' : ''"></span> </td> </tr> <tr ng-repeat="item in commits.changeSets.deleteItems" ng-show="item.key || item.comment"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.Deleted' | translate }} </td> <td width="20%" title="{{item.key}}"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' :''"></span> </td> <td width="28%" title="{{item.value}}"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...': ''"></span> </td> <td width="28%"> </td> <td width="18%" title="{{item.comment}}"> <span ng-bind="item.comment | limitTo: 250"></span> <span ng-bind="item.comment.length > 250 ?'...' : ''"></span> </td> </tr> </tbody> </table> <!--not properties format--> <div ng-if="!namespace.isPropertiesFormat"> <div ng-repeat="item in commits.changeSets.createItems"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-bind="item.value"> </textarea> </div> <div ng-repeat="item in commits.changeSets.updateItems"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-bind="item.newItem.value"> </textarea> </div> </div> </div> <hr> </div> <div class="text-center"> <button type="button" class="btn btn-default" ng-show="!namespace.hasLoadAllCommit" ng-click="loadCommitHistory(namespace)">{{'Component.Namespace.Master.Items.Body.HistoryView.LoadMore' | translate }} <span class="glyphicon glyphicon-menu-down"></span></button> </div> <div class="empty-container text-center" ng-show="!namespace.commits || !namespace.commits.length"> {{'Component.Namespace.Master.Items.Body.HistoryView.NoHistory' | translate }} </div> </div> <!--instance view--> <div class="panel panel-default instance-view" ng-show="namespace.viewType == 'instance'"> <div class="panel-heading"> <div class="row"> <div class="col-md-5 col-sm-5"> <small>{{'Component.Namespace.Master.Items.Body.Instance.Tips' | translate }}</small> </div> <div class="col-md-7 col-sm-7 text-right"> <div class="btn-group btn-group-sm" role="group"> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'latest_release'}" ng-click="switchInstanceViewType(namespace, 'latest_release')"> {{'Component.Namespace.Master.Items.Body.Instance.UsedNewItem' | translate }} <span class="badge" ng-bind="namespace.latestReleaseInstances.total"></span> </button> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'not_latest_release'}" ng-click="switchInstanceViewType(namespace, 'not_latest_release')">{{'Component.Namespace.Master.Items.Body.Instance.NoUsedNewItem' | translate }} <span class="badge" ng-bind="namespace.instancesCount - namespace.latestReleaseInstances.total"></span> </button> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'all'}" ng-click="switchInstanceViewType(namespace, 'all')">{{'Component.Namespace.Master.Items.Body.Instance.AllInstance' | translate }} <span class="badge" ng-bind="namespace.instancesCount"></span> </button> </div> <button class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.RefreshList' | translate }}" ng-click="refreshInstancesInfo(namespace)"> <img ng-src="{{ '/img/refresh.png' | prefixPath }}" /> </button> </div> </div> </div> <!--latest release instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'latest_release'"> <div class="panel-default" ng-if="namespace.latestReleaseInstances.total > 0"> <div class="panel-heading"> <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.ToSeeItem' | translate }}" ng-href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{namespace.latestRelease.id}}"> {{namespace.latestRelease.name}} </a> </div> <table class="table table-bordered table-striped"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemGetTime' | translate }} </td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.latestReleaseInstances.content"> <td width="20%" ng-bind="instance.appId"></td> <td width="20%" ng-bind="instance.clusterName"></td> <td width="20%" ng-bind="instance.dataCenter"></td> <td width="20%" ng-bind="instance.ip"></td> <td width="20%">{{instance.configs && instance.configs.length ? (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}} </td> </tr> </tbody> </table> <div class="row text-center" ng-show="namespace.latestReleaseInstances.content.length < namespace.latestReleaseInstances.total"> <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">{{'Component.Namespace.Master.Items.Body.Instance.LoadMore' | translate }}</button> </div> </div> <div class="text-center" ng-if="namespace.latestReleaseInstances.total == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> <!--not latest release instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'not_latest_release'"> <div class="panel-default" ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total > 0" ng-repeat="release in namespace.notLatestReleases"> <div class="panel-heading"> <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.ToSeeItem' | translate }}" href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{release.id}}"> {{release.name}} </a> </div> <table class="table table-bordered table-striped"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemGetTime' | translate }} </td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.notLatestReleaseInstances[release.id]"> <td width="20%" ng-bind="instance.appId"></td> <td width="20%" ng-bind="instance.clusterName"></td> <td width="20%" ng-bind="instance.dataCenter"></td> <td width="20%" ng-bind="instance.ip"></td> <td width="20%">{{instance.configs && instance.configs.length ? (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}} </td> </tr> </tbody> </table> </div> <div class="text-center" ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> <!--all instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'all'"> <div class="panel-default" ng-if="namespace.instancesCount > 0"> <table class="table table-bordered table-striped" ng-if="namespace.allInstances"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.allInstances"> <td width="25%" ng-bind="instance.appId"></td> <td width="25%" ng-bind="instance.clusterName"></td> <td width="25%" ng-bind="instance.dataCenter"></td> <td width="25%" ng-bind="instance.ip"></td> </tr> </tbody> </table> <div class="row text-center" ng-show="namespace.allInstances.length < namespace.instancesCount"> <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">{{'Component.Namespace.Master.Items.Body.Instance.LoadMore' | translate }}</button> </div> </div> <div class="text-center" ng-if="namespace.instancesCount == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> </div> </section> </div> </section>
<!--master panel body when not initialized--> <section class="master-panel-body" ng-if="!namespace.initialized"> <!--main header--> <header class="panel-heading"> <div class="row"> <div class="col-md-6 col-sm-6 header-namespace"> <b class="namespace-name" ng-bind="namespace.viewName" data-tooltip="tooltip" data-placement="bottom" title="{{namespace.comment}}"></b> <span class="label label-warning no-radius namespace-label modify-tip" ng-show="namespace.itemModifiedCnt > 0"> {{'Component.Namespace.Master.Items.Changed' | translate }} <span class="badge label badge-white namespace-label" ng-bind="namespace.itemModifiedCnt"></span> </span> </div> <div class="col-md-6 col-sm-6 text-right header-buttons"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.LoadNamespaceTips' | translate }}" ng-click="refreshNamespace()"> <img src="img/more.png"> {{'Component.Namespace.Master.LoadNamespace' | translate }} </button> </div> </div> </header> </section> <!--master panel body--> <section class="master-panel-body" ng-if="namespace.initialized && (namespace.hasBranch && namespace.displayControl.currentOperateBranch == 'master' || !namespace.hasBranch)"> <!--main header--> <header class="panel-heading"> <div class="row"> <div class="col-md-6 col-sm-6 header-namespace"> <b class="namespace-name" ng-bind="namespace.viewName" data-tooltip="tooltip" data-placement="bottom" title="{{namespace.comment}}"></b> <span class="label label-warning no-radius namespace-label modify-tip" ng-show="namespace.itemModifiedCnt > 0"> {{'Component.Namespace.Master.Items.Changed' | translate }} <span class="badge label badge-white namespace-label" ng-bind="namespace.itemModifiedCnt"></span> </span> <span class="label label-primary no-radius namespace-label" ng-show="namespace.lockOwner">{{'Component.Namespace.Master.Items.ChangedUser' | translate }}:{{namespace.lockOwner}}</span> </div> <div class="col-md-6 col-sm-6 text-right header-buttons"> <button type="button" class="btn btn-success btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.PublishTips' | translate }}" ng-show="(namespace.hasReleasePermission || namespace.hasModifyPermission)" ng-disabled="namespace.isTextEditing" ng-click="publish(namespace)"> <img src="img/release.png"> {{'Component.Namespace.Master.Items.Publish' | translate }} </button> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RollbackTips' | translate }}" ng-show="namespace.hasReleasePermission" ng-click="rollback(namespace)"> <img src="img/rollback.png"> {{'Component.Namespace.Master.Items.Rollback' | translate }} </button> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.PublishHistoryTips' | translate }}" href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}"> <img src="img/release-history.png"> {{'Component.Namespace.Master.Items.PublishHistory' | translate }} </a> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrantTips' | translate }}" href="{{ '/namespace/role.html' | prefixPath }}?#/appid={{appId}}&namespaceName={{namespace.baseInfo.namespaceName}}" ng-show="hasAssignUserPermission"> <img src="img/assign.png"> {{'Component.Namespace.Master.Items.Grant' | translate }} </a> <a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrayscaleTips' | translate }}" ng-show="!namespace.hasBranch && namespace.isPropertiesFormat && namespace.hasModifyPermission" ng-click="preCreateBranch(namespace)"> <img src="img/test.png"> {{'Component.Namespace.Master.Items.Grayscale' | translate }} </a> <a type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RequestPermissionTips' | translate }}" ng-click="showNoModifyPermissionDialog()" ng-show="!namespace.hasModifyPermission && !namespace.hasReleasePermission"> {{'Component.Namespace.Master.Items.RequestPermission' | translate }} </a> <div class="btn-group" ng-show="namespace.hasModifyPermission || namespace.hasReleasePermission || hasAssignUserPermission"> <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <img src="img/operate.png"> <span class="caret"></span> </button> <ul class="dropdown-menu" style="right: 0; left: -160px;"> <li ng-click="deleteNamespace(namespace)"> <a style="color: red"> <img src="img/delete.png"> {{'Component.Namespace.Master.Items.DeleteNamespace' | translate }}</a> </li> </ul> </div> </div> </div> </header> <div id="BODY{{namespace.id}}" ng-class="{'collapse in': showNamespaceBody, 'collapse' : !showNamespaceBody}"> <div class="J_namespace-release-tip well well-sm no-radius text-center" ng-show="namespace.isConfigHidden"> <span style="color: red">{{'Component.Namespace.Master.Items.NoPermissionTips' | translate }}</span> </div> <!--second header--> <header class="panel-heading second-panel-heading" ng-show="!namespace.isConfigHidden"> <div class="row"> <div class="col-md-6 col-sm-6 pull-left"> <!--master branch nav tabs--> <ul class="nav nav-tabs"> <li role="presentation" ng-click="switchView(namespace, 'table')" ng-show="namespace.isPropertiesFormat"> <a ng-class="{node_active:namespace.viewType == 'table'}"> <img src="img/table.png"> {{'Component.Namespace.Master.Items.ItemList' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'text')"> <a ng-class="{node_active:namespace.viewType == 'text'}"> <img src="img/text.png"> {{'Component.Namespace.Master.Items.ItemListByText' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'history')"> <a ng-class="{node_active:namespace.viewType == 'history'}"> <img src="img/change.png"> {{'Component.Namespace.Master.Items.ItemHistory' | translate }} </a> </li> <li role="presentation" ng-click="switchView(namespace, 'instance')"> <a ng-class="{node_active:namespace.viewType == 'instance'}"> <img src="img/machine.png"> {{'Component.Namespace.Master.Items.ItemInstance' | translate }} <span class="badge badge-grey" ng-bind="namespace.instancesCount"></span> </a> </li> </ul> </div> <div class="col-md-6 col-sm-6 text-right"> <img src="img/copy.png" class="ns_btn clipboard cursor-pointer" data-clipboard-text="{{namespace.text}}" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.CopyText' | translate }}" ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission"> <img src="img/syntax.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.GrammarCheck' | translate }}" ng-show="namespace.isTextEditing && namespace.viewType == 'text' && namespace.isSyntaxCheckable" ng-click="syntaxCheck(namespace)"> &nbsp; <img src="img/cancel.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.CancelChanged' | translate }}" ng-show="namespace.isTextEditing && namespace.viewType == 'text'" ng-click="toggleTextEditStatus(namespace)"> <img src="img/edit.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Change' | translate }}" ng-show="!namespace.isTextEditing && namespace.viewType == 'text' && namespace.hasModifyPermission" ng-click="toggleTextEditStatus(namespace)"> &nbsp; <img src="img/submit.png" class="ns_btn cursor-pointer" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SummitChanged' | translate }}" data-toggle="modal" data-target="#commitModal" ng-show="namespace.isTextEditing && namespace.viewType == 'text'" ng-click="modifyByText(namespace)"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SortByKey' | translate }}" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && !namespace.isLinkedNamespace" ng-click="toggleItemSearchInput(namespace)"> <span class="glyphicon glyphicon-filter"></span> {{'Component.Namespace.Master.Items.FilterItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.SyncItemTips' | translate }}" ng-click="goToSyncPage(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission && namespace.isPropertiesFormat"> <img src="img/sync.png"> {{'Component.Namespace.Master.Items.SyncItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.RevokeItemTips' | translate }}" ng-click="preRevokeItem(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission && namespace.isPropertiesFormat"> <img src="img/rollback.png"> {{'Component.Namespace.Master.Items.RevokeItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm J_tableview_btn" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.DiffItemTips' | translate }}" ng-click="goToDiffPage(namespace)" ng-show="namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.isPropertiesFormat"> <img src="img/diff.png"> {{'Component.Namespace.Master.Items.DiffItem' | translate }} </button> <button type="button" class="btn btn-primary btn-sm" ng-show="!namespace.isLinkedNamespace && namespace.viewType == 'table' && namespace.displayControl.currentOperateBranch == 'master' && namespace.hasModifyPermission" ng-click="createItem(namespace)"> <img src="img/plus.png"> {{'Component.Namespace.Master.Items.AddItem' | translate }} </button> </div> </div> </header> <!--namespace body--> <section ng-show="!namespace.isConfigHidden"> <!--table view--> <div class="namespace-view-table" ng-show="namespace.viewType == 'table'"> <div class="J_namespace-release-tip well well-sm no-radius text-center" ng-show="namespace.isLatestReleaseLoaded && !namespace.isLinkedNamespace && !namespace.latestRelease"> <span style="color: red"> {{'Component.Namespace.Master.Items.Body.ItemsNoPublishedTips' | translate }}</span> </div> <!--not link namespace--> <div ng-if="!namespace.isLinkedNamespace"> <div class="search-input" ng-show="namespace.displayControl.showSearchInput"> <input type="text" class="form-control" placeholder="{{'Component.Namespace.Master.Items.Body.FilterByKey' | translate }}" ng-model="namespace.searchKey" ng-change="searchItems(namespace)"> </div> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.PublishState' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc" ng-if="config.item.key" ng-class="{'warning': !config.item.value}"> <td width="8%" class="text-center"> <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NoPublishTitle' | translate }}" ng-click="showText(config.oldValue?config.oldValue:('Component.Namespace.Master.Items.Body.NoPublishTips' | translate))">{{'Component.Namespace.Master.Items.Body.NoPublish' | translate }}</span> <span class="label label-default-light no-radius" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.PublishedTitle' | translate }}" ng-if="!config.isModified">{{'Component.Namespace.Master.Items.Body.Published' | translate }}</span> </td> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.HaveGrayscale' | translate }}" ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'">{{'Component.Namespace.Master.Items.Body.Grayscale' | translate }}</span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="30%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="13%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="16%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="8%" class="text-center" ng-if="!config.isDeleted"> <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifyTips' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> <img style="margin-left: 5px;" src="img/cancel.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeleteTips' | translate }}" ng-click="preDeleteItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> </div> <!--link namespace--> <div class="panel panel-default" ng-if="namespace.isLinkedNamespace"> <div class="panel-heading"> <div class="row"> <div class="padding-top-5 col-md-4 col-sm-4"> {{'Component.Namespace.Master.Items.Body.Link.Title' | translate }} </div> <div class="col-md-8 col-sm-8"> <input type="text" class="form-control pull-right" placeholder="filter by key ..." ng-class="{'search-onblur': namespace.searchStatus == 'OFF' || !namespace.searchStatus, 'search-focus': namespace.searchStatus == 'ON'}" ng-model="namespace.searchKey" ng-change="searchItems(namespace)" ng-focus="namespace.searchStatus='ON'" ng-blur="namespace.searchStatus='OFF'"> </div> </div> </div> <table class="table table-bordered table-striped table-hover" ng-if="namespace.viewItems && namespace.viewItems.length"> <thead> <tr> <th>{{'Component.Namespace.Master.Items.Body.PublishState' | translate }}</th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.viewItems |orderBy:col:desc" ng-if="config.item.key"> <td width="8%" class="text-center"> <span class="label label-warning no-radius cursor-pointer" ng-if="config.isModified" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NoPublishTitle' | translate }}" ng-click="showText(config.oldValue?config.oldValue:('Component.Namespace.Master.Items.Body.NoPublishTips' | translate))">{{'Component.Namespace.Master.Items.Body.NoPublish' | translate }}</span> <span class="label label-default-light no-radius" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.PublishedTitle' | translate }}" ng-if="!config.isModified">{{'Component.Namespace.Master.Items.Body.Published' | translate }}</span> </td> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-default cursor-pointer" ng-if="config.hasBranchValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.HaveGrayscale' | translate }}" ng-click="namespace.displayControl.currentOperateBranch=namespace.branchName;namespace.branch.viewType='table'">{{'Component.Namespace.Master.Items.Body.Grayscale' | translate }}</span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="30%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="13%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="16%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="8%" class="text-center" ng-if="!config.isDeleted"> <img src="img/edit.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifyTips' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> <img style="margin-left: 5px;" src="img/cancel.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeleteTips' | translate }}" ng-click="preDeleteItem(namespace, config.item)" ng-show="namespace.hasModifyPermission"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="!namespace.viewItems || !namespace.viewItems.length"> <h5>{{'Component.Namespace.Master.Items.Body.Link.NoCoverLinkItem' | translate }}</h5> </div> </div> <!--link namespace's public namespace--> <div ng-if="namespace.isLinkedNamespace"> <div class="panel panel-default" ng-if="namespace.publicNamespace"> <div class="panel-heading"> <div class="row"> <div class="padding-top-5 col-md-4 col-sm-4"> {{'Component.Namespace.Master.Items.Body.Public.Title' | translate }} <a href="{{ '/config.html' | prefixPath }}?#/appid={{namespace.publicNamespace.baseInfo.appId}}&env={{env}}&cluster={{namespace.publicNamespace.baseInfo.clusterName}}" target="_blank"> <small> ({{'Common.AppId' | translate }}:{{namespace.publicNamespace.baseInfo.appId}}, {{'Common.Cluster' | translate }}:{{namespace.publicNamespace.baseInfo.clusterName}}) </small> </a> </div> <div class="col-md-4 col-sm-4 text-center"> <div class="btn-group btn-group-sm" role="group" ng-show="namespace.publicNamespace.isModified"> <button type="button" class="btn btn-default" ng-class="{'active':namespace.publicNamespaceViewType == 'RELEASE' || !namespace.publicNamespaceViewType}" ng-click="namespace.publicNamespaceViewType = 'RELEASE'"> {{'Component.Namespace.Master.Items.Body.Public.Published' | translate }} </button> <button type="button" class="btn btn-default" ng-class="{'active':namespace.publicNamespaceViewType == 'NOT_RELEASE'}" ng-click="namespace.publicNamespaceViewType = 'NOT_RELEASE'"> {{'Component.Namespace.Master.Items.Body.Public.NoPublish' | translate }} </button> </div> </div> <div class="col-md-4 col-sm-4"> <input type="text" class="form-control pull-right" placeholder="filter by key ..." ng-class="{'search-onblur': namespace.publicNamespace.searchStatus == 'OFF' || !namespace.publicNamespace.searchStatus, 'search-focus': namespace.publicNamespace.searchStatus == 'ON'}" ng-model="namespace.publicNamespace.searchKey" ng-change="searchItems(namespace.publicNamespace)" ng-blur="namespace.publicNamespace.searchStatus='OFF'" ng-focus="namespace.publicNamespace.searchStatus='ON'" /> </div> </div> </div> <!--published items--> <div ng-show="!namespace.publicNamespaceViewType || namespace.publicNamespaceViewType == 'RELEASE'"> <table class="table table-bordered table-striped table-hover" ng-show="namespace.publicNamespace.hasPublishedItem"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedBy';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModify' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc" ng-if="config.item.key && !config.isModified && !config.isDeleted"> <td width="15%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> </td> <td width="35%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="15%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="10%" class="text-center" ng-if="!config.isDeleted"> <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Public.PublishedAndCover' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission && !config.covered"> </td> <td width="6%" class="text-center" ng-if="config.isDeleted"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="namespace.publicNamespace.viewItems && namespace.publicNamespace.viewItems.length && !namespace.publicNamespace.hasPublishedItem"> <h5>{{'Component.Namespace.Master.Items.Body.Public.NoPublished' | translate }}</h5> </div> </div> <!--not published items--> <table class="table table-bordered table-striped table-hover" ng-show="namespace.publicNamespaceViewType == 'NOT_RELEASE'"> <thead> <tr> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.key';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemKey' | translate }}&nbsp; <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.NoPublished.PublishedValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.NoPublished.NoPublishedValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.ItemComment' | translate }} </th> <th class="hover" title="{{'Component.Namespace.Master.Items.Body.Sort' | translate }}" ng-click="col='item.dataChangeLastModifiedTime';desc=!desc;"> {{'Component.Namespace.Master.Items.Body.ItemLastModifyTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </th> <th> {{'Component.Namespace.Master.Items.Body.ItemOperator' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in namespace.publicNamespace.viewItems |orderBy:col:desc" ng-if="config.item.key && (config.isModified || config.isDeleted)"> <td width="20%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.key)"> <span ng-bind="config.item.key | limitTo: 250"></span> <span ng-bind="config.item.key.length > 250 ? '...' :''"></span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.NewAddedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.ModifiedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.DeletedTips' | translate }}">{{'Component.Namespace.Master.Items.Body.Deleted' | translate }}</span> </td> <td width="25%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.oldValue)"> <span ng-bind="config.oldValue | limitTo: 250"></span> <span ng-bind="config.oldValue.length > 250 ? '...': ''"></span> </td> <td width="25%" class="cursor-pointer" title="{{'Component.Namespace.Master.Items.Body.ClickToSee' | translate }}" ng-click="showText(config.item.value)"> <span ng-bind="config.item.value | limitTo: 250"></span> <span ng-bind="config.item.value.length > 250 ? '...': ''"></span> </td> <td width="10%" title="{{config.item.comment}}"> <span ng-bind="config.item.comment | limitTo: 250"></span> <span ng-bind="config.item.comment.length > 250 ?'...' : ''"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> <td width="5%" class="text-center" ng-if="!config.isDeleted"> <img src="img/gray.png" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Public.PublishedAndCover' | translate }}" ng-click="editItem(namespace, config.item)" ng-show="namespace.hasModifyPermission && !config.covered"> </td> </tr> </tbody> </table> <div class="text-center no-config-panel" ng-if="!namespace.publicNamespace.viewItems || !namespace.publicNamespace.viewItems.length"> <h5>{{'Component.Namespace.Master.Items.Body.NoPublished.Title' | translate }}</h5> </div> </div> <div class="panel panel-default" ng-if="!namespace.publicNamespace"> <div class="panel-heading"> {{'Component.Namespace.Master.Items.Body.Public.Title' | translate }} </div> <div class="panel-body text-center"> {{'Component.Namespace.Master.Items.Body.Public.NoPublicNamespaceTips1' | translate }} <a href="{{ '/config.html' | prefixPath }}?#/appid={{namespace.parentAppId}}" target="_blank">{{namespace.parentAppId}}</a> {{'Component.Namespace.Master.Items.Body.Public.NoPublicNamespaceTips2' | translate:this }} </div> </div> </div> </div> <!--text view--> <!--只读模式下的文本内容,不替换换行符--> <div ui-ace="aceConfig" readonly="true" class="form-control no-radius" rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}" ng-show="namespace.viewType == 'text' && !namespace.isTextEditing" ng-model="namespace.text"> </div> <!--编辑状态下的文本内容,会过滤掉换行符--> <div ui-ace="aceConfig" class="form-control no-radius" rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}" ng-show="namespace.viewType == 'text' && namespace.isTextEditing" ng-disabled="!namespace.isTextEditing" ng-model="namespace.editText"> </div> <!--history view--> <div class="J_historyview history-view" ng-show="namespace.viewType == 'history'"> <div class="media" ng-show="namespace.commits && namespace.commits.length" ng-repeat="commits in namespace.commits"> <div class="media-body"> <div class="row"> <div class="col-md-6 col-sm-6"> <h3 class="media-heading" ng-bind="commits.dataChangeCreatedBy"></h3> </div> <div class="col-md-6 col-sm-6 text-right"> <h5 class="media-heading" ng-bind="commits.dataChangeCreatedTime | date: 'yyyy-MM-dd HH:mm:ss'"></h5> </div> </div> <!--properties format--> <table class="table table-bordered table-striped text-center table-hover" style="margin-top: 5px;" ng-if="namespace.isPropertiesFormat"> <thead> <tr> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemType' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemKey' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemOldValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemNewValue' | translate }} </th> <th> {{'Component.Namespace.Master.Items.Body.HistoryView.ItemComment' | translate }} </th> </tr> </thead> <tbody> <!--兼容老数据,不显示item类型为空行和注释的item--> <tr ng-repeat="item in commits.changeSets.createItems" ng-show="item.key"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.NewAdded' | translate }} </td> <td width="20%" title="{{item.key}}"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' :''"></span> </td> <td width="28%"> </td> <td width="28%" class="cursor-pointer" title="{{item.value}}" ng-click="showText(item.value)"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...': ''"></span> </td> <td width="18%" title="{{item.comment}}"> <span ng-bind="item.comment | limitTo: 250"></span> <span ng-bind="item.comment.length > 250 ?'...' : ''"></span> </td> </tr> <tr ng-repeat="item in commits.changeSets.updateItems"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.Updated' | translate }} </td> <td width="20%" title="{{item.newItem.key}}"> <span ng-bind="item.newItem.key | limitTo: 250"></span> <span ng-bind="item.newItem.key.length > 250 ? '...' :''"></span> </td> <td width="28%" class="cursor-pointer" title="{{item.oldItem.value}}" ng-click="showText(item.oldItem.value)"> <span ng-bind="item.oldItem.value | limitTo: 250"></span> <span ng-bind="item.oldItem.value.length > 250 ? '...': ''"></span> </td> <td width="28%" class="cursor-pointer" title="{{item.newItem.value}}" ng-click="showText(item.newItem.value)"> <span ng-bind="item.newItem.value | limitTo: 250"></span> <span ng-bind="item.newItem.value.length > 250 ? '...': ''"></span> </td> <td width="18%" title="{{item.newItem.comment}}"> <span ng-bind="item.newItem.comment | limitTo: 250"></span> <span ng-bind="item.newItem.comment.length > 250 ?'...' : ''"></span> </td> </tr> <tr ng-repeat="item in commits.changeSets.deleteItems" ng-show="item.key || item.comment"> <td width="6%"> {{'Component.Namespace.Master.Items.Body.HistoryView.Deleted' | translate }} </td> <td width="20%" title="{{item.key}}"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' :''"></span> </td> <td width="28%" title="{{item.value}}"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...': ''"></span> </td> <td width="28%"> </td> <td width="18%" title="{{item.comment}}"> <span ng-bind="item.comment | limitTo: 250"></span> <span ng-bind="item.comment.length > 250 ?'...' : ''"></span> </td> </tr> </tbody> </table> <!--not properties format--> <div ng-if="!namespace.isPropertiesFormat"> <div ng-repeat="item in commits.changeSets.createItems"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-bind="item.value"> </textarea> </div> <div ng-repeat="item in commits.changeSets.updateItems"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-bind="item.newItem.value"> </textarea> </div> </div> </div> <hr> </div> <div class="text-center"> <button type="button" class="btn btn-default" ng-show="!namespace.hasLoadAllCommit" ng-click="loadCommitHistory(namespace)">{{'Component.Namespace.Master.Items.Body.HistoryView.LoadMore' | translate }} <span class="glyphicon glyphicon-menu-down"></span></button> </div> <div class="empty-container text-center" ng-show="!namespace.commits || !namespace.commits.length"> {{'Component.Namespace.Master.Items.Body.HistoryView.NoHistory' | translate }} </div> </div> <!--instance view--> <div class="panel panel-default instance-view" ng-show="namespace.viewType == 'instance'"> <div class="panel-heading"> <div class="row"> <div class="col-md-5 col-sm-5"> <small>{{'Component.Namespace.Master.Items.Body.Instance.Tips' | translate }}</small> </div> <div class="col-md-7 col-sm-7 text-right"> <div class="btn-group btn-group-sm" role="group"> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'latest_release'}" ng-click="switchInstanceViewType(namespace, 'latest_release')"> {{'Component.Namespace.Master.Items.Body.Instance.UsedNewItem' | translate }} <span class="badge" ng-bind="namespace.latestReleaseInstances.total"></span> </button> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'not_latest_release'}" ng-click="switchInstanceViewType(namespace, 'not_latest_release')">{{'Component.Namespace.Master.Items.Body.Instance.NoUsedNewItem' | translate }} <span class="badge" ng-bind="namespace.instancesCount - namespace.latestReleaseInstances.total"></span> </button> <button type="button" class="btn btn-default" ng-class="{'btn-primary':namespace.instanceViewType == 'all'}" ng-click="switchInstanceViewType(namespace, 'all')">{{'Component.Namespace.Master.Items.Body.Instance.AllInstance' | translate }} <span class="badge" ng-bind="namespace.instancesCount"></span> </button> </div> <button class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.RefreshList' | translate }}" ng-click="refreshInstancesInfo(namespace)"> <img ng-src="{{ '/img/refresh.png' | prefixPath }}" /> </button> </div> </div> </div> <!--latest release instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'latest_release'"> <div class="panel-default" ng-if="namespace.latestReleaseInstances.total > 0"> <div class="panel-heading"> <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.ToSeeItem' | translate }}" ng-href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{namespace.latestRelease.id}}"> {{namespace.latestRelease.name}} </a> </div> <table class="table table-bordered table-striped"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemGetTime' | translate }} </td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.latestReleaseInstances.content"> <td width="20%" ng-bind="instance.appId"></td> <td width="20%" ng-bind="instance.clusterName"></td> <td width="20%" ng-bind="instance.dataCenter"></td> <td width="20%" ng-bind="instance.ip"></td> <td width="20%">{{instance.configs && instance.configs.length ? (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}} </td> </tr> </tbody> </table> <div class="row text-center" ng-show="namespace.latestReleaseInstances.content.length < namespace.latestReleaseInstances.total"> <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">{{'Component.Namespace.Master.Items.Body.Instance.LoadMore' | translate }}</button> </div> </div> <div class="text-center" ng-if="namespace.latestReleaseInstances.total == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> <!--not latest release instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'not_latest_release'"> <div class="panel-default" ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total > 0" ng-repeat="release in namespace.notLatestReleases"> <div class="panel-heading"> <a target="_blank" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Master.Items.Body.Instance.ToSeeItem' | translate }}" href="{{ '/config/history.html' | prefixPath }}?#/appid={{appId}}&env={{env}}&clusterName={{cluster}}&namespaceName={{namespace.baseInfo.namespaceName}}&releaseId={{release.id}}"> {{release.name}} </a> </div> <table class="table table-bordered table-striped"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemGetTime' | translate }} </td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.notLatestReleaseInstances[release.id]"> <td width="20%" ng-bind="instance.appId"></td> <td width="20%" ng-bind="instance.clusterName"></td> <td width="20%" ng-bind="instance.dataCenter"></td> <td width="20%" ng-bind="instance.ip"></td> <td width="20%">{{instance.configs && instance.configs.length ? (instance.configs[0].releaseDeliveryTime | date: 'yyyy-MM-dd HH:mm:ss') : ''}} </td> </tr> </tbody> </table> </div> <div class="text-center" ng-if="namespace.instancesCount - namespace.latestReleaseInstances.total == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> <!--all instances--> <div class="panel-body" ng-show="namespace.instanceViewType == 'all'"> <div class="panel-default" ng-if="namespace.instancesCount > 0"> <table class="table table-bordered table-striped" ng-if="namespace.allInstances"> <thead> <tr> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemAppId' | translate }}</td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemCluster' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemDataCenter' | translate }} </td> <td>{{'Component.Namespace.Master.Items.Body.Instance.ItemIp' | translate }}</td> </tr> </thead> <tbody> <tr ng-repeat="instance in namespace.allInstances"> <td width="25%" ng-bind="instance.appId"></td> <td width="25%" ng-bind="instance.clusterName"></td> <td width="25%" ng-bind="instance.dataCenter"></td> <td width="25%" ng-bind="instance.ip"></td> </tr> </tbody> </table> <div class="row text-center" ng-show="namespace.allInstances.length < namespace.instancesCount"> <button class="btn btn-default" ng-click="loadInstanceInfo(namespace)">{{'Component.Namespace.Master.Items.Body.Instance.LoadMore' | translate }}</button> </div> </div> <div class="text-center" ng-if="namespace.instancesCount == 0"> {{'Component.Namespace.Master.Items.Body.Instance.NoInstanceTips' | translate }} </div> </div> </div> </section> </div> </section>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/namespace/role.html
<!doctype html> <html ng-app="role"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Namespace.Role.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container"> <section class="panel col-md-offset-1 col-md-10" ng-controller="NamespaceRoleController"> <header class="panel-heading"> <div class="row"> <div class="col-md-9"> <h4 class="modal-title"> {{'Namespace.Role.Title' | translate }}<small>({{'Common.AppId' | translate }}:<label ng-bind="pageContext.appId"></label> {{'Common.Namespace' | translate }}:<label ng-bind="pageContext.namespaceName"></label>)</small> </h4> </div> <div class="col-md-3 text-right"> <a type="button" class="btn btn-info" data-dismiss="modal" href="{{ '/config.html' | prefixPath }}?#appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }} </a> </div> </div> </header> <div class="panel-body" ng-show="hasAssignUserPermission"> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Namespace.Role.GrantModifyTo' | translate }}<br><small>{{'Namespace.Role.GrantModifyTo2' | translate }}</small></label> <div class="col-sm-8"> <form class="form-inline" ng-submit="assignRoleToUser('ModifyNamespace')"> <div class="form-group"> <apollouserselector apollo-id="modifyRoleWidgetId"></apollouserselector> <select class="form-control input-sm" ng-model="modifyRoleSelectedEnv"> <option value="">{{'Namespace.Role.AllEnv' | translate }}</option> <option ng-repeat="env in envs" ng-value="env">{{env}}</option> </select> </div> <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="modifyRoleSubmitBtnDisabled">{{'Namespace.Role.Add' | translate }}</button> </form> <!-- Split button --> <div class="item-container"> <h5>{{'Namespace.Role.AllEnv' | translate }}</h5> <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.modifyRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ModifyNamespace', user.userId, null)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> <div class="item-container" ng-repeat="env in envs"> <h5>{{env}}</h5> <div class="btn-group item-info" ng-repeat="user in envRolesAssignedUsers[env].modifyRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ModifyNamespace', user.userId, env)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> </div> </div> </div> <hr> <div class="row" style="margin-top: 10px;"> <div class="form-horizontal"> <div class="col-sm-2 text-right"> <label class="control-label">{{'Namespace.Role.GrantPublishTo' | translate }}<br><small>{{'Namespace.Role.GrantPublishTo2' | translate }}</small></label> </div> <div class="col-sm-8"> <form class="form-inline" ng-submit="assignRoleToUser('ReleaseNamespace')"> <div class="form-group"> <apollouserselector apollo-id="releaseRoleWidgetId"></apollouserselector> <select class="form-control input-sm" ng-model="releaseRoleSelectedEnv"> <option value="">{{'Namespace.Role.AllEnv' | translate }}</option> <option ng-repeat="env in envs" ng-value="env">{{env}}</option> </select> </div> <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="ReleaseRoleSubmitBtnDisabled">{{'Namespace.Role.Add' | translate }}</button> </form> <!-- Split button --> <div class="item-container"> <h5>{{'Namespace.Role.AllEnv' | translate }}</h5> <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.releaseRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ReleaseNamespace', user.userId, null)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> <div class="item-container" ng-repeat="env in envs"> <h5>{{env}}</h5> <div class="btn-group item-info" ng-repeat="user in envRolesAssignedUsers[env].releaseRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ReleaseNamespace', user.userId, env)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> </div> </div> </div> </div> </div> <div class="panel-body text-center" ng-show="!hasAssignUserPermission"> <h2>{{'Namespace.Role.NoPermission' | translate }}</h2> </div> </section> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/controller/role/NamespaceRoleController.js"></script> </body> </html>
<!doctype html> <html ng-app="role"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Namespace.Role.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container"> <section class="panel col-md-offset-1 col-md-10" ng-controller="NamespaceRoleController"> <header class="panel-heading"> <div class="row"> <div class="col-md-9"> <h4 class="modal-title"> {{'Namespace.Role.Title' | translate }}<small>({{'Common.AppId' | translate }}:<label ng-bind="pageContext.appId"></label> {{'Common.Namespace' | translate }}:<label ng-bind="pageContext.namespaceName"></label>)</small> </h4> </div> <div class="col-md-3 text-right"> <a type="button" class="btn btn-info" data-dismiss="modal" href="{{ '/config.html' | prefixPath }}?#appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }} </a> </div> </div> </header> <div class="panel-body" ng-show="hasAssignUserPermission"> <div class="row"> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Namespace.Role.GrantModifyTo' | translate }}<br><small>{{'Namespace.Role.GrantModifyTo2' | translate }}</small></label> <div class="col-sm-8"> <form class="form-inline" ng-submit="assignRoleToUser('ModifyNamespace')"> <div class="form-group"> <apollouserselector apollo-id="modifyRoleWidgetId"></apollouserselector> <select class="form-control input-sm" ng-model="modifyRoleSelectedEnv"> <option value="">{{'Namespace.Role.AllEnv' | translate }}</option> <option ng-repeat="env in envs" ng-value="env">{{env}}</option> </select> </div> <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="modifyRoleSubmitBtnDisabled">{{'Namespace.Role.Add' | translate }}</button> </form> <!-- Split button --> <div class="item-container"> <h5>{{'Namespace.Role.AllEnv' | translate }}</h5> <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.modifyRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ModifyNamespace', user.userId, null)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> <div class="item-container" ng-repeat="env in envs"> <h5>{{env}}</h5> <div class="btn-group item-info" ng-repeat="user in envRolesAssignedUsers[env].modifyRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ModifyNamespace', user.userId, env)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> </div> </div> </div> <hr> <div class="row" style="margin-top: 10px;"> <div class="form-horizontal"> <div class="col-sm-2 text-right"> <label class="control-label">{{'Namespace.Role.GrantPublishTo' | translate }}<br><small>{{'Namespace.Role.GrantPublishTo2' | translate }}</small></label> </div> <div class="col-sm-8"> <form class="form-inline" ng-submit="assignRoleToUser('ReleaseNamespace')"> <div class="form-group"> <apollouserselector apollo-id="releaseRoleWidgetId"></apollouserselector> <select class="form-control input-sm" ng-model="releaseRoleSelectedEnv"> <option value="">{{'Namespace.Role.AllEnv' | translate }}</option> <option ng-repeat="env in envs" ng-value="env">{{env}}</option> </select> </div> <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="ReleaseRoleSubmitBtnDisabled">{{'Namespace.Role.Add' | translate }}</button> </form> <!-- Split button --> <div class="item-container"> <h5>{{'Namespace.Role.AllEnv' | translate }}</h5> <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.releaseRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ReleaseNamespace', user.userId, null)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> <div class="item-container" ng-repeat="env in envs"> <h5>{{env}}</h5> <div class="btn-group item-info" ng-repeat="user in envRolesAssignedUsers[env].releaseRoleUsers"> <button type="button" class="btn btn-default" ng-bind="user.userId"></button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ReleaseNamespace', user.userId, env)"> <span class="glyphicon glyphicon-remove"></span> </button> </div> </div> </div> </div> </div> </div> </div> <div class="panel-body text-center" ng-show="!hasAssignUserPermission"> <h2>{{'Namespace.Role.NoPermission' | translate }}</h2> </div> </section> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/controller/role/NamespaceRoleController.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/config/history.html
<!doctype html> <html ng-app="release_history"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Config.History.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container" ng-controller="ReleaseHistoryController"> <section class="release-history panel col-md-12 no-radius hidden"> <div class="panel-heading row"> <div class="operation-caption-container col-md-3"> <div class="operation-caption release-operation-normal text-center" style="left:0;"> <small>{{'Config.History.MasterVersionPublish' | translate }}</small> </div> <div class="operation-caption release-operation-rollback text-center" style="left: 110px;"> <small>{{'Config.History.MasterVersionRollback' | translate }}</small> </div> <div class="operation-caption release-operation-gray text-center" style="left: 220px;"> <small>{{'Config.History.GrayscaleOperator' | translate }}</small> </div> </div> <div class="col-md-6 text-center"> <h4>{{'Config.History.PublishHistory' | translate }}</h4> <small>({{'Common.AppId' | translate }}:{{pageContext.appId}}, {{'Common.Environment' | translate }}:{{pageContext.env}}, {{'Common.Cluster' | translate }}:{{pageContext.clusterName}}, {{'Common.Namespace' | translate }}:{{pageContext.namespaceName}}) </small> </div> <div class="pull-right back-btn"> <a type="button" class="btn btn-info" href="{{ '/config.html' | prefixPath }}?#/appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }} </a> </div> </div> <div class="release-history-container panel-body row" ng-show="!isConfigHidden && releaseHistories && releaseHistories.length > 0"> <div class="release-history-list col-md-3"> <div class="media hover" ng-class="{'active': releaseHistory.id == selectedReleaseHistory}" ng-repeat="releaseHistory in releaseHistories" ng-click="showReleaseHistoryDetail(releaseHistory)"> <div class="release-operation" ng-class="{'release-operation-normal': releaseHistory.operation == 0 || releaseHistory.operation == 5, 'release-operation-gray': releaseHistory.operation == 2 || releaseHistory.operation == 3 || releaseHistory.operation == 4 || releaseHistory.operation == 7 || releaseHistory.operation == 8, 'release-operation-rollback': releaseHistory.operation == 1 || releaseHistory.operation == 6}"> </div> <h4 class="media-left text-center" ng-bind="releaseHistory.operator"> </h4> <div class="media-body"> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 0"> {{'Config.History.OperationType0' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 1"> {{'Config.History.OperationType1' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 2"> {{'Config.History.OperationType2' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 3"> {{'Config.History.OperationType3' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 4"> {{'Config.History.OperationType4' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 5"> {{'Config.History.OperationType5' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 6"> {{'Config.History.OperationType6' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 7"> {{'Config.History.OperationType7' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 8"> {{'Config.History.OperationType8' | translate }}</h5> <h6 class="col-md-5 text-right" ng-bind="releaseHistory.releaseTimeFormatted"></h6> <span class="label label-warning no-radius emergency-publish" ng-if="releaseHistory.operationContext.isEmergencyPublish">{{'Config.History.UrgentPublish' | translate }}</span> </div> </div> <div class="load-more media panel-heading text-center hover" ng-show="!hasLoadAll" ng-click="findReleaseHistory()"> {{'Config.History.LoadMore' | translate }} </div> </div> <!--properties mode info--> <div class="release-info col-md-9 panel panel-default no-radius" ng-show="!isTextNamespace"> <div class="panel-heading"> <span ng-bind="history.releaseTitle"></span> <span class="label label-warning no-radius" ng-if="history.isReleaseAbandoned">{{'Config.History.Abandoned' | translate }}</span> <span class="pull-right" ng-bind="history.releaseTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> <div class="row" style="padding-top: 10px;"> <div class="col-md-5"> <small ng-show="history.releaseComment" ng-bind="history.releaseComment"></small> </div> <div class="col-md-7 text-right"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.RollbackToTips' | translate }}" ng-show="namespace.hasReleasePermission && !history.isReleaseAbandoned && (history.operation == 0 || history.operation == 1 || history.operation == 4)" ng-click="preRollback()"> <img src="../img/rollback.png"> {{'Config.History.RollbackTo' | translate }} </button> <div class="btn-group"> <button type="button" class="btn btn-default btn-sm" ng-class="{'active':history.viewType == 'diff'}" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.ChangedItemTips' | translate }}" ng-click="switchConfigViewType(history, 'diff')">{{'Config.History.ChangedItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm" ng-class="{'active':history.viewType == 'all'}" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.AllItemTips' | translate }}" ng-click="switchConfigViewType(history, 'all')">{{'Config.History.AllItem' | translate }} </button> </div> </div> </div> </div> <div class="panel-body config"> <section ng-show="history.viewType=='diff'"> <h4 class="section-title">{{'Config.History.ChangedItem' | translate }}</h4> <div ng-show="history.changes && history.changes.length > 0"> <table class="no-margin table table-striped table-hover table-bordered"> <thead> <tr> <th>{{'Config.History.ChangeType' | translate }}</th> <th>{{'Config.History.ChangeKey' | translate }}</th> <th>{{'Config.History.ChangeOldValue' | translate }}</th> <th>{{'Config.History.ChangeNewValue' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="change in history.changes"> <td width="10%"> <span ng-show="change.type == 'ADDED'">{{'Config.History.ChangeTypeNew' | translate }}</span> <span ng-show="change.type == 'MODIFIED'">{{'Config.History.ChangeTypeModify' | translate }}</span> <span ng-show="change.type == 'DELETED'">{{'Config.History.ChangeTypeDelete' | translate }}</span> </td> <td class="cursor-pointer" width="20%" ng-click="showText(change.entity.firstEntity.key)"> <span ng-bind="change.entity.firstEntity.key | limitTo: 250"></span> <span ng-bind="change.entity.firstEntity.key.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="35%" ng-click="showText(change.entity.firstEntity.value)"> <span ng-bind="change.entity.firstEntity.value | limitTo: 250"></span> <span ng-bind="change.entity.firstEntity.value.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="35%" ng-click="showText(change.entity.secondEntity.value)"> <span ng-bind="change.entity.secondEntity.value | limitTo: 250"></span> <span ng-bind="change.entity.secondEntity.value.length > 250 ? '...' :''"></span> </td> </tr> </tbody> </table> </div> <div class="text-center empty-container" ng-show="!history.changes || history.changes.length == 0"> <h5>{{'Config.History.NoChange' | translate }}</h5> </div> </section> <section ng-show="history.viewType=='all'"> <h4 class="section-title">{{'Config.History.AllItem' | translate }}</h4> <table class="no-margin table table-striped table-hover table-bordered" ng-show="history.configuration && history.configuration.length > 0"> <thead> <tr> <th>{{'Config.History.ChangeKey' | translate }}</th> <th>{{'Config.History.ChangeValue' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="item in history.configuration"> <td class="cursor-pointer" width="30%" ng-click="showText(item.firstEntity)"> <span ng-bind="item.firstEntity | limitTo: 250"></span> <span ng-bind="item.firstEntity.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="70%" ng-click="showText(item.secondEntity)"> <span ng-bind="item.secondEntity | limitTo: 250"></span> <span ng-bind="item.secondEntity.length > 250 ? '...' :''"></span> </td> </tr> </tbody> </table> <div class="text-center empty-container" ng-show="history.viewType=='all' && (!history.configuration || history.configuration.length == 0)"> <h5>{{'Config.History.NoItem' | translate }}</h5> </div> </section> <section ng-show="history.branchName != history.clusterName && history.operation != 8 && history.operation != 7"> <hr> <h4 class="section-title">{{'Config.History.GrayscaleRule' | translate }}</h4> <table class="no-margin table table-striped table-hover table-bordered" ng-show="history.operationContext.rules"> <thead> <tr> <th>{{'Config.History.GrayscaleAppId' | translate }}</th> <th>{{'Config.History.GrayscaleIp' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="rule in history.operationContext.rules"> <td width="20%" ng-bind="rule.clientAppId"></td> <td width="80%" ng-bind="rule.clientIpList.join(', ')"></td> </tr> </tbody> </table> <h5 class="text-center empty-container" ng-show="!history.operationContext.rules"> {{'Config.History.NoGrayscaleRule' | translate }} </h5> </section> </div> </div> <!--text mode--> <div class="release-info col-md-9" ng-show="isTextNamespace && history.changes && history.changes.length > 0"> <apollodiff ng-repeat="change in history.changes" old-str="change.entity.firstEntity.value" new-str="change.entity.secondEntity.value" apollo-id="'releaseStrDiff'"> </apollodiff> </div> </div> <div class="panel-body" ng-show="isConfigHidden || !releaseHistories || releaseHistories.length == 0"> <h4 class="text-center empty-container" ng-show="isConfigHidden"> {{'Config.History.NoPermissionTips' | translate }}</h4> <h4 class="text-center empty-container" ng-show="!isConfigHidden"> {{'Config.History.NoPublishHistory' | translate }}</h4> </div> </section> <showtextmodal text="text"></showtextmodal> <rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName"> </rollbackmodal> <apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'" apollo-title="'Config.RollbackAlert.DialogTitle' | translate" apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true" apollo-confirm="rollback"> </apolloconfirmdialog> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/diff.min.js" type="text/javascript"></script> <!--biz--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/ReleaseService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/ReleaseHistoryService.js"></script> <script type="application/javascript" src="../scripts/services/ConfigService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/services/EventManager.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/controller/config/ReleaseHistoryController.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script> <script type="application/javascript" src="../scripts/directive/diff-directive.js"></script> <script type="application/javascript" src="../scripts/directive/rollback-modal-directive.js"></script> </body> </html>
<!doctype html> <html ng-app="release_history"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Config.History.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container" ng-controller="ReleaseHistoryController"> <section class="release-history panel col-md-12 no-radius hidden"> <div class="panel-heading row"> <div class="operation-caption-container col-md-3"> <div class="operation-caption release-operation-normal text-center" style="left:0;"> <small>{{'Config.History.MasterVersionPublish' | translate }}</small> </div> <div class="operation-caption release-operation-rollback text-center" style="left: 110px;"> <small>{{'Config.History.MasterVersionRollback' | translate }}</small> </div> <div class="operation-caption release-operation-gray text-center" style="left: 220px;"> <small>{{'Config.History.GrayscaleOperator' | translate }}</small> </div> </div> <div class="col-md-6 text-center"> <h4>{{'Config.History.PublishHistory' | translate }}</h4> <small>({{'Common.AppId' | translate }}:{{pageContext.appId}}, {{'Common.Environment' | translate }}:{{pageContext.env}}, {{'Common.Cluster' | translate }}:{{pageContext.clusterName}}, {{'Common.Namespace' | translate }}:{{pageContext.namespaceName}}) </small> </div> <div class="pull-right back-btn"> <a type="button" class="btn btn-info" href="{{ '/config.html' | prefixPath }}?#/appid={{pageContext.appId}}">{{'Common.ReturnToIndex' | translate }} </a> </div> </div> <div class="release-history-container panel-body row" ng-show="!isConfigHidden && releaseHistories && releaseHistories.length > 0"> <div class="release-history-list col-md-3"> <div class="media hover" ng-class="{'active': releaseHistory.id == selectedReleaseHistory}" ng-repeat="releaseHistory in releaseHistories" ng-click="showReleaseHistoryDetail(releaseHistory)"> <div class="release-operation" ng-class="{'release-operation-normal': releaseHistory.operation == 0 || releaseHistory.operation == 5, 'release-operation-gray': releaseHistory.operation == 2 || releaseHistory.operation == 3 || releaseHistory.operation == 4 || releaseHistory.operation == 7 || releaseHistory.operation == 8, 'release-operation-rollback': releaseHistory.operation == 1 || releaseHistory.operation == 6}"> </div> <h4 class="media-left text-center" ng-bind="releaseHistory.operator"> </h4> <div class="media-body"> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 0"> {{'Config.History.OperationType0' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 1"> {{'Config.History.OperationType1' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 2"> {{'Config.History.OperationType2' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 3"> {{'Config.History.OperationType3' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 4"> {{'Config.History.OperationType4' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 5"> {{'Config.History.OperationType5' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 6"> {{'Config.History.OperationType6' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 7"> {{'Config.History.OperationType7' | translate }}</h5> <h5 class="col-md-7 word-break" ng-show="releaseHistory.operation == 8"> {{'Config.History.OperationType8' | translate }}</h5> <h6 class="col-md-5 text-right" ng-bind="releaseHistory.releaseTimeFormatted"></h6> <span class="label label-warning no-radius emergency-publish" ng-if="releaseHistory.operationContext.isEmergencyPublish">{{'Config.History.UrgentPublish' | translate }}</span> </div> </div> <div class="load-more media panel-heading text-center hover" ng-show="!hasLoadAll" ng-click="findReleaseHistory()"> {{'Config.History.LoadMore' | translate }} </div> </div> <!--properties mode info--> <div class="release-info col-md-9 panel panel-default no-radius" ng-show="!isTextNamespace"> <div class="panel-heading"> <span ng-bind="history.releaseTitle"></span> <span class="label label-warning no-radius" ng-if="history.isReleaseAbandoned">{{'Config.History.Abandoned' | translate }}</span> <span class="pull-right" ng-bind="history.releaseTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> <div class="row" style="padding-top: 10px;"> <div class="col-md-5"> <small ng-show="history.releaseComment" ng-bind="history.releaseComment"></small> </div> <div class="col-md-7 text-right"> <button type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.RollbackToTips' | translate }}" ng-show="namespace.hasReleasePermission && !history.isReleaseAbandoned && (history.operation == 0 || history.operation == 1 || history.operation == 4)" ng-click="preRollback()"> <img src="../img/rollback.png"> {{'Config.History.RollbackTo' | translate }} </button> <div class="btn-group"> <button type="button" class="btn btn-default btn-sm" ng-class="{'active':history.viewType == 'diff'}" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.ChangedItemTips' | translate }}" ng-click="switchConfigViewType(history, 'diff')">{{'Config.History.ChangedItem' | translate }} </button> <button type="button" class="btn btn-default btn-sm" ng-class="{'active':history.viewType == 'all'}" data-tooltip="tooltip" data-placement="bottom" title="{{'Config.History.AllItemTips' | translate }}" ng-click="switchConfigViewType(history, 'all')">{{'Config.History.AllItem' | translate }} </button> </div> </div> </div> </div> <div class="panel-body config"> <section ng-show="history.viewType=='diff'"> <h4 class="section-title">{{'Config.History.ChangedItem' | translate }}</h4> <div ng-show="history.changes && history.changes.length > 0"> <table class="no-margin table table-striped table-hover table-bordered"> <thead> <tr> <th>{{'Config.History.ChangeType' | translate }}</th> <th>{{'Config.History.ChangeKey' | translate }}</th> <th>{{'Config.History.ChangeOldValue' | translate }}</th> <th>{{'Config.History.ChangeNewValue' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="change in history.changes"> <td width="10%"> <span ng-show="change.type == 'ADDED'">{{'Config.History.ChangeTypeNew' | translate }}</span> <span ng-show="change.type == 'MODIFIED'">{{'Config.History.ChangeTypeModify' | translate }}</span> <span ng-show="change.type == 'DELETED'">{{'Config.History.ChangeTypeDelete' | translate }}</span> </td> <td class="cursor-pointer" width="20%" ng-click="showText(change.entity.firstEntity.key)"> <span ng-bind="change.entity.firstEntity.key | limitTo: 250"></span> <span ng-bind="change.entity.firstEntity.key.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="35%" ng-click="showText(change.entity.firstEntity.value)"> <span ng-bind="change.entity.firstEntity.value | limitTo: 250"></span> <span ng-bind="change.entity.firstEntity.value.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="35%" ng-click="showText(change.entity.secondEntity.value)"> <span ng-bind="change.entity.secondEntity.value | limitTo: 250"></span> <span ng-bind="change.entity.secondEntity.value.length > 250 ? '...' :''"></span> </td> </tr> </tbody> </table> </div> <div class="text-center empty-container" ng-show="!history.changes || history.changes.length == 0"> <h5>{{'Config.History.NoChange' | translate }}</h5> </div> </section> <section ng-show="history.viewType=='all'"> <h4 class="section-title">{{'Config.History.AllItem' | translate }}</h4> <table class="no-margin table table-striped table-hover table-bordered" ng-show="history.configuration && history.configuration.length > 0"> <thead> <tr> <th>{{'Config.History.ChangeKey' | translate }}</th> <th>{{'Config.History.ChangeValue' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="item in history.configuration"> <td class="cursor-pointer" width="30%" ng-click="showText(item.firstEntity)"> <span ng-bind="item.firstEntity | limitTo: 250"></span> <span ng-bind="item.firstEntity.length > 250 ? '...' :''"></span> </td> <td class="cursor-pointer" width="70%" ng-click="showText(item.secondEntity)"> <span ng-bind="item.secondEntity | limitTo: 250"></span> <span ng-bind="item.secondEntity.length > 250 ? '...' :''"></span> </td> </tr> </tbody> </table> <div class="text-center empty-container" ng-show="history.viewType=='all' && (!history.configuration || history.configuration.length == 0)"> <h5>{{'Config.History.NoItem' | translate }}</h5> </div> </section> <section ng-show="history.branchName != history.clusterName && history.operation != 8 && history.operation != 7"> <hr> <h4 class="section-title">{{'Config.History.GrayscaleRule' | translate }}</h4> <table class="no-margin table table-striped table-hover table-bordered" ng-show="history.operationContext.rules"> <thead> <tr> <th>{{'Config.History.GrayscaleAppId' | translate }}</th> <th>{{'Config.History.GrayscaleIp' | translate }}</th> </tr> </thead> <tbody> <tr ng-repeat="rule in history.operationContext.rules"> <td width="20%" ng-bind="rule.clientAppId"></td> <td width="80%" ng-bind="rule.clientIpList.join(', ')"></td> </tr> </tbody> </table> <h5 class="text-center empty-container" ng-show="!history.operationContext.rules"> {{'Config.History.NoGrayscaleRule' | translate }} </h5> </section> </div> </div> <!--text mode--> <div class="release-info col-md-9" ng-show="isTextNamespace && history.changes && history.changes.length > 0"> <apollodiff ng-repeat="change in history.changes" old-str="change.entity.firstEntity.value" new-str="change.entity.secondEntity.value" apollo-id="'releaseStrDiff'"> </apollodiff> </div> </div> <div class="panel-body" ng-show="isConfigHidden || !releaseHistories || releaseHistories.length == 0"> <h4 class="text-center empty-container" ng-show="isConfigHidden"> {{'Config.History.NoPermissionTips' | translate }}</h4> <h4 class="text-center empty-container" ng-show="!isConfigHidden"> {{'Config.History.NoPublishHistory' | translate }}</h4> </div> </section> <showtextmodal text="text"></showtextmodal> <rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName"> </rollbackmodal> <apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'" apollo-title="'Config.RollbackAlert.DialogTitle' | translate" apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true" apollo-confirm="rollback"> </apolloconfirmdialog> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/diff.min.js" type="text/javascript"></script> <!--biz--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/ReleaseService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/ReleaseHistoryService.js"></script> <script type="application/javascript" src="../scripts/services/ConfigService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/services/EventManager.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/controller/config/ReleaseHistoryController.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script> <script type="application/javascript" src="../scripts/directive/diff-directive.js"></script> <script type="application/javascript" src="../scripts/directive/rollback-modal-directive.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/entrance.html
<a class="list-group-item hover" href="{{href}}"> <div class="row icon-text icon-{{imgSrc}}"> <p class="btn-title">{{title}}</p> </div> </a>
<a class="list-group-item hover" href="{{href}}"> <div class="row icon-text icon-{{imgSrc}}"> <p class="btn-title">{{title}}</p> </div> </a>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/user-manage.html
<!doctype html> <html ng-app="user"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'UserMange.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container" ng-controller="UserController"> <div class="col-md-8 col-md-offset-2 panel"> <section class="panel-body" ng-show="isRootUser"> <div class="row"> <header class="panel-heading"> {{'UserMange.Title' | translate }} <small> {{'UserMange.TitleTips' | translate }} </small> </header> <form class="form-horizontal panel-body" name="appForm" valdr-type="App" ng-submit="createOrUpdateUser()"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.UserName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="username" ng-model="user.username"> <small>{{'UserMange.UserNameTips' | translate }}</small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.Pwd' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="password" ng-model="user.password"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.Email' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="password" ng-model="user.email"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} </button> </div> </div> </form> </div> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/controller/UserController.js"></script> <script src="scripts/valdr.js" type="text/javascript"></script> </body> </html>
<!doctype html> <html ng-app="user"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="./img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'UserMange.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container" ng-controller="UserController"> <div class="col-md-8 col-md-offset-2 panel"> <section class="panel-body" ng-show="isRootUser"> <div class="row"> <header class="panel-heading"> {{'UserMange.Title' | translate }} <small> {{'UserMange.TitleTips' | translate }} </small> </header> <form class="form-horizontal panel-body" name="appForm" valdr-type="App" ng-submit="createOrUpdateUser()"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.UserName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="username" ng-model="user.username"> <small>{{'UserMange.UserNameTips' | translate }}</small> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.Pwd' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="password" ng-model="user.password"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'UserMange.Email' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" name="password" ng-model="user.email"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} </button> </div> </div> </form> </div> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/controller/UserController.js"></script> <script src="scripts/valdr.js" type="text/javascript"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/config_export.html
<!doctype html> <html ng-app="config_export"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'ConfigExport.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid"> <div class="col-md-8 col-md-offset-2 panel"> <section class="panel-body"> <div class="row"> <header class="panel-heading"> {{'ConfigExport.Title' | translate }} <small> {{'ConfigExport.TitleTips' | translate}} </small> </header> <div class="col-sm-offset-2 col-sm-9"> <a href="export" target="_blank"> <button class="btn btn-block btn-lg btn-primary"> {{'ConfigExport.Download' | translate }} </button> </a> </div> </div> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-route.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/lodash.min.js"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/ClusterService.js"></script> <script type="application/javascript" src="scripts/services/NamespaceService.js"></script> <script type="application/javascript" src="scripts/services/SystemInfoService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/PageCommon.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/valdr.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> </body> </html>
<!doctype html> <html ng-app="config_export"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <title>{{'ConfigExport.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid"> <div class="col-md-8 col-md-offset-2 panel"> <section class="panel-body"> <div class="row"> <header class="panel-heading"> {{'ConfigExport.Title' | translate }} <small> {{'ConfigExport.TitleTips' | translate}} </small> </header> <div class="col-sm-offset-2 col-sm-9"> <a href="export" target="_blank"> <button class="btn btn-block btn-lg btn-primary"> {{'ConfigExport.Download' | translate }} </button> </a> </div> </div> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-route.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/lodash.min.js"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/ClusterService.js"></script> <script type="application/javascript" src="scripts/services/NamespaceService.js"></script> <script type="application/javascript" src="scripts/services/SystemInfoService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/PageCommon.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/valdr.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/services/OrganizationService.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/namespace-panel-header.html
<header class="row namespace-attribute-panel"> <div class="row"> <div class="col-md-6" style="padding-bottom:5px;"> <span class="text-center namespace-attribute-public label label-primary no-radius"> <span data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Header.Title.PrivateTips' | translate:this }}" ng-show="!namespace.isPublic">{{'Component.Namespace.Header.Title.Private' | translate }}</span> <span data-tooltip="tooltip" data-placement="top" title="{{'Component.Namespace.Header.Title.PublicTips' | translate:this }}" ng-show="namespace.isPublic && namespace.parentAppId == namespace.baseInfo.appId">{{'Component.Namespace.Header.Title.Public' | translate }}</span> <span data-tooltip="tooltip" data-placement="top" title="{{'Component.Namespace.Header.Title.ExtendTips' | translate:this }}" ng-show="namespace.isPublic && namespace.isLinkedNamespace" ng-click="goToParentAppConfigPage(namespace)">{{'Component.Namespace.Header.Title.Extend' | translate }}</span> </span> <span class="text-center namespace-attribute-public label label-info no-radius"> <span ng-bind="namespace.format" style="width:30px;"></span> </span> </div> <div class="col-md-6 text-right" style="padding-right:23px;"> <span data-toggle="collapse" data-target="#BODY{{namespace.branch.id}}" aria-expanded="false"> <span class="label no-radius cursor-pointer" data-toggle="collapse" data-target="#BODY{{namespace.id}}" aria-expanded="false" ng-click="showNamespaceBody = !showNamespaceBody" ng-show="namespace.initialized"> <a>{{'Component.Namespace.Header.Title.ExpandAndCollapse' | translate }}</a> </span> </span> </div> </div> </header> <!--branch nav--> <header class="panel-heading second-panel-heading" ng-show="namespace.initialized && namespace.hasBranch"> <div class="row"> <div class="col-md-8 pull-left"> <ul class="nav nav-tabs"> <li role="presentation"> <a ng-class="{'node_active': namespace.displayControl.currentOperateBranch == 'master'}" ng-click="switchBranch('master', true)"> <img src="img/branch.png"> {{'Component.Namespace.Header.Title.Master' | translate }} </a> </li> <li role="presentation"> <a ng-class="{'node_active': namespace.displayControl.currentOperateBranch != 'master'}" ng-click="switchBranch(namespace.branchName, true)"> <img src="img/branch.png"> {{'Component.Namespace.Header.Title.Grayscale' | translate }} </a> </li> </ul> </div> </div> </header>
<header class="row namespace-attribute-panel"> <div class="row"> <div class="col-md-6" style="padding-bottom:5px;"> <span class="text-center namespace-attribute-public label label-primary no-radius"> <span data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Namespace.Header.Title.PrivateTips' | translate:this }}" ng-show="!namespace.isPublic">{{'Component.Namespace.Header.Title.Private' | translate }}</span> <span data-tooltip="tooltip" data-placement="top" title="{{'Component.Namespace.Header.Title.PublicTips' | translate:this }}" ng-show="namespace.isPublic && namespace.parentAppId == namespace.baseInfo.appId">{{'Component.Namespace.Header.Title.Public' | translate }}</span> <span data-tooltip="tooltip" data-placement="top" title="{{'Component.Namespace.Header.Title.ExtendTips' | translate:this }}" ng-show="namespace.isPublic && namespace.isLinkedNamespace" ng-click="goToParentAppConfigPage(namespace)">{{'Component.Namespace.Header.Title.Extend' | translate }}</span> </span> <span class="text-center namespace-attribute-public label label-info no-radius"> <span ng-bind="namespace.format" style="width:30px;"></span> </span> </div> <div class="col-md-6 text-right" style="padding-right:23px;"> <span data-toggle="collapse" data-target="#BODY{{namespace.branch.id}}" aria-expanded="false"> <span class="label no-radius cursor-pointer" data-toggle="collapse" data-target="#BODY{{namespace.id}}" aria-expanded="false" ng-click="showNamespaceBody = !showNamespaceBody" ng-show="namespace.initialized"> <a>{{'Component.Namespace.Header.Title.ExpandAndCollapse' | translate }}</a> </span> </span> </div> </div> </header> <!--branch nav--> <header class="panel-heading second-panel-heading" ng-show="namespace.initialized && namespace.hasBranch"> <div class="row"> <div class="col-md-8 pull-left"> <ul class="nav nav-tabs"> <li role="presentation"> <a ng-class="{'node_active': namespace.displayControl.currentOperateBranch == 'master'}" ng-click="switchBranch('master', true)"> <img src="img/branch.png"> {{'Component.Namespace.Header.Title.Master' | translate }} </a> </li> <li role="presentation"> <a ng-class="{'node_active': namespace.displayControl.currentOperateBranch != 'master'}" ng-click="switchBranch(namespace.branchName, true)"> <img src="img/branch.png"> {{'Component.Namespace.Header.Title.Grayscale' | translate }} </a> </li> </ul> </div> </div> </header>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/delete_app_cluster_namespace.html
<!doctype html> <html ng-app="delete_app_cluster_namespace"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <title>{{'Delete.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid" ng-controller="DeleteAppClusterNamespaceController"> <div class="col-md-10 col-md-offset-1 panel"> <section class="panel-body" ng-show="isRootUser"> <!-- delete app --> <section class="row"> <h5>{{'Delete.DeleteApp' | translate }} <small> {{'Delete.DeleteAppTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="app.appId"> <small> {{'Delete.AppIdTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getAppInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Delete.AppInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="app.info" ng-bind="app.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteAppBtnDisabled" ng-click="deleteApp()"> {{'Delete.DeleteApp' | translate }} </button> </div> </div> </form> </section> <!-- delete cluster --> <section class="row"> <h5>{{'Delete.DeleteCluster' | translate }} <small> {{'Delete.DeleteClusterTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.appId"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Delete.EnvName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.env"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.ClusterName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.name"> <small>{{'Delete.ClusterNameTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getClusterInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" viv clform-group> <label class="col-sm-2 control-label"> {{'Delete.ClusterInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="cluster.info" ng-bind="cluster.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteClusterBtnDisabled" ng-click="deleteCluster()"> {{'Delete.DeleteCluster' | translate }} </button> </div> </div> </form> </section> <!-- delete app namespace --> <section class="row"> <h5>{{'Delete.DeleteNamespace' | translate }} <small>{{'Delete.DeleteNamespaceTips' | translate }}</small> </h5> <small> {{'Delete.DeleteNamespaceTips2' | translate }} </small> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="appNamespace.appId"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Delete.AppNamespaceName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="appNamespace.name"> <small>{{'Delete.AppNamespaceNameTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getAppNamespaceInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" viv clform-group> <label class="col-sm-2 control-label"> {{'Delete.AppNamespaceInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="appNamespace.info" ng-bind="appNamespace.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteAppNamespaceBtnDisabled" ng-click="deleteAppNamespace()"> {{'Delete.DeleteNamespace' | translate }} </button> </div> </div> </form> </section> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-route.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/lodash.min.js"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/ClusterService.js"></script> <script type="application/javascript" src="scripts/services/NamespaceService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/PageCommon.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/valdr.js"></script> <script type="application/javascript" src="scripts/controller/DeleteAppClusterNamespaceController.js"></script> </body> </html>
<!doctype html> <html ng-app="delete_app_cluster_namespace"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <title>{{'Delete.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid" ng-controller="DeleteAppClusterNamespaceController"> <div class="col-md-10 col-md-offset-1 panel"> <section class="panel-body" ng-show="isRootUser"> <!-- delete app --> <section class="row"> <h5>{{'Delete.DeleteApp' | translate }} <small> {{'Delete.DeleteAppTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="app.appId"> <small> {{'Delete.AppIdTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getAppInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> {{'Delete.AppInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="app.info" ng-bind="app.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteAppBtnDisabled" ng-click="deleteApp()"> {{'Delete.DeleteApp' | translate }} </button> </div> </div> </form> </section> <!-- delete cluster --> <section class="row"> <h5>{{'Delete.DeleteCluster' | translate }} <small> {{'Delete.DeleteClusterTips' | translate }} </small> </h5> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.appId"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Delete.EnvName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.env"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.ClusterName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="cluster.name"> <small>{{'Delete.ClusterNameTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getClusterInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" viv clform-group> <label class="col-sm-2 control-label"> {{'Delete.ClusterInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="cluster.info" ng-bind="cluster.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteClusterBtnDisabled" ng-click="deleteCluster()"> {{'Delete.DeleteCluster' | translate }} </button> </div> </div> </form> </section> <!-- delete app namespace --> <section class="row"> <h5>{{'Delete.DeleteNamespace' | translate }} <small>{{'Delete.DeleteNamespaceTips' | translate }}</small> </h5> <small> {{'Delete.DeleteNamespaceTips2' | translate }} </small> <hr> <form class="form-horizontal"> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Common.AppId' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="appNamespace.appId"> </div> </div> <div class="form-group" valdr-form-group> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Delete.AppNamespaceName' | translate }} </label> <div class="col-sm-5"> <input type="text" class="form-control" ng-model="appNamespace.name"> <small>{{'Delete.AppNamespaceNameTips' | translate }}</small> </div> <div class="col-sm-1"> <button class="btn btn-info" ng-click="getAppNamespaceInfo()">{{'Common.Search' | translate }}</button> </div> </div> <div class="form-group" viv clform-group> <label class="col-sm-2 control-label"> {{'Delete.AppNamespaceInfo' | translate }}</label> <div class="col-sm-5"> <h5 ng-show="appNamespace.info" ng-bind="appNamespace.info"></h5> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-9"> <button type="submit" class="btn btn-primary" ng-disabled="deleteAppNamespaceBtnDisabled" ng-click="deleteAppNamespace()"> {{'Delete.DeleteNamespace' | translate }} </button> </div> </div> </form> </section> </section> <section class="panel-body text-center" ng-if="!isRootUser"> <h4>{{'Common.IsRootUser' | translate }}</h4> </section> </div> </div> <div ng-include="'views/common/footer.html'"></div> <!-- jquery.js --> <script src="vendor/jquery.min.js" type="text/javascript"></script> <!--angular--> <script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular-route.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/angular-cookies.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!--valdr--> <script src="vendor/valdr/valdr.min.js" type="text/javascript"></script> <script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script> <!-- bootstrap.js --> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/lodash.min.js"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!--biz--> <!--must import--> <script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/services/AppService.js"></script> <script type="application/javascript" src="scripts/services/EnvService.js"></script> <script type="application/javascript" src="scripts/services/UserService.js"></script> <script type="application/javascript" src="scripts/services/CommonService.js"></script> <script type="application/javascript" src="scripts/services/PermissionService.js"></script> <script type="application/javascript" src="scripts/services/ClusterService.js"></script> <script type="application/javascript" src="scripts/services/NamespaceService.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/PageCommon.js"></script> <script type="application/javascript" src="scripts/directive/directive.js"></script> <script type="application/javascript" src="scripts/valdr.js"></script> <script type="application/javascript" src="scripts/controller/DeleteAppClusterNamespaceController.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/release-modal.html
<form id="releaseModal" class="modal fade form-horizontal" name="releaseForm" valdr-type="Release" ng-submit="release()"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" ng-show="!toReleaseNamespace.isBranch"> {{'Component.Publish.Title' | translate }} <small>{{'Component.Publish.Tips' | translate:this }}</small> </h4> <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.Grayscale' | translate }} <small>{{'Component.Publish.GrayscaleTips' | translate }}</small> </h4> <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.AllPublish' | translate }} <small>{{'Component.Publish.AllPublishTips' | translate }}</small> </h4> </div> <div class="release modal-body"> <div class="form-group"> <div class="col-sm-2 control-label" ng-if="!toReleaseNamespace.isPropertiesFormat"> <div class="row"> <div class="btn-group btn-group-xs" style="padding-right: 10px" role="group"> <button type="button" class="btn btn-default" ng-class="{active:releaseChangeViewType=='change'}" ng-click="switchReleaseChangeViewType('change')">{{'Component.Publish.ToSeeChange' | translate }} </button> <button type="button" class="btn btn-default" ng-class="{active:releaseChangeViewType=='release'}" ng-click="switchReleaseChangeViewType('release')">{{'Component.Publish.PublishedValue' | translate }} </button> </div> </div> </div> <label class="col-sm-2 control-label" ng-if="toReleaseNamespace.isPropertiesFormat">{{'Component.Publish.Changes' | translate }}</label> <div class="col-sm-10" ng-if="(!toReleaseNamespace.isBranch && toReleaseNamespace.itemModifiedCnt) || (toReleaseNamespace.isBranch && toReleaseNamespace.itemModifiedCnt) || (toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length)" valdr-form-group> <!--properties format--> <!--normal release--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && !toReleaseNamespace.isBranch"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th> {{'Component.Publish.PublishedValue' | translate }} </th> <th> {{'Component.Publish.NoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.items" ng-if="config.item.key && config.isModified"> <td width="20%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.NewAddedTips' | translate }}">{{'Component.Publish.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.ModifiedTips' | translate }}">{{'Component.Publish.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.DeletedTips' | translate }}">{{'Component.Publish.Deleted' | translate }}</span> </td> <td width="25%" title="{{config.oldValue}}"> <span ng-bind="config.oldValue"></span> </td> <td width="25%" title="{{config.newValue}}"> <span ng-bind="config.newValue"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--branch gray release--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th> {{'Component.Publish.MasterValue' | translate }} </th> <th> {{'Component.Publish.GrayPublishedValue' | translate }} </th> <th> {{'Component.Publish.GrayNoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.branchItems" ng-if="config.isModified || config.isDeleted"> <td width="15%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> <span class="label label-danger" ng-show="config.isDeleted">{{'Component.Publish.Deleted' | translate }}</span> </td> <td width="20%" title="{{config.masterReleaseValue}}"> <span ng-bind="config.masterReleaseValue"></span> </td> <td width="20%" title="{{config.oldValue}}"> <span ng-bind="config.oldValue"></span> </td> <td width="20%" title="{{config.newValue}}"> <span ng-bind="config.newValue"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--branch updateAndPublish and publish--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th ng-if="toReleaseNamespace.isBranch"> {{'Component.Publish.MasterValue' | translate }} </th> <th ng-if="toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.GrayValue' | translate }} </th> <th ng-if="!toReleaseNamespace.isBranch || !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.PublishedValue' | translate }} </th> <th ng-if="!toReleaseNamespace.isBranch || !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.NoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.branchItems" ng-if="!config.isDeleted"> <td width="20%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> </td> <td width="25%" title="{{config.masterReleaseValue}}"> <span ng-bind="config.masterReleaseValue"></span> </td> <td width="25%" title="{{config.item.value}}"> <span ng-bind="config.item.value"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--file format --> <div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat" ng-show="releaseChangeViewType=='change'"> <apollodiff old-str="item.oldValue" new-str="item.newValue" apollo-id="'releaseStrDiff'"> </apollodiff> </div> <div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat" ng-show="releaseChangeViewType=='release'"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-show="item.newValue" ng-bind="item.newValue"> </textarea> </div> </div> <div class="col-sm-5" ng-show="(!toReleaseNamespace.isBranch && !toReleaseNamespace.itemModifiedCnt)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.ItemNoChange' | translate }} </label> </div> <div class="col-sm-5" ng-show="(toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish && !toReleaseNamespace.itemModifiedCnt)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.GrayItemNoChange' | translate }} </label> </div> <div class="col-sm-5" ng-show="(toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length == 0)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.NoGrayItems' | translate }} </label> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Component.Publish.Release' | translate }} </label> <div class="col-sm-5" valdr-form-group> <input type="text" name="releaseName" class="form-control" placeholder="input release name" ng-model="toReleaseNamespace.releaseTitle" ng-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">{{'Component.Publish.ReleaseComment' | translate }}</label> <div class="col-sm-10" valdr-form-group> <textarea rows="4" name="comment" class="form-control" style="margin-top: 15px;" ng-model="releaseComment" placeholder="Add an optional extended description..."></textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">{{'Common.Cancel' | translate }}</button> <button type="submit" class="btn btn-primary" ng-disabled="releaseForm.$invalid || releaseBtnDisabled || (toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length == 0)"> {{'Component.Publish.OpPublish' | translate }} </button> </div> </div> </div> </form>
<form id="releaseModal" class="modal fade form-horizontal" name="releaseForm" valdr-type="Release" ng-submit="release()"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" ng-show="!toReleaseNamespace.isBranch"> {{'Component.Publish.Title' | translate }} <small>{{'Component.Publish.Tips' | translate:this }}</small> </h4> <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.Grayscale' | translate }} <small>{{'Component.Publish.GrayscaleTips' | translate }}</small> </h4> <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.AllPublish' | translate }} <small>{{'Component.Publish.AllPublishTips' | translate }}</small> </h4> </div> <div class="release modal-body"> <div class="form-group"> <div class="col-sm-2 control-label" ng-if="!toReleaseNamespace.isPropertiesFormat"> <div class="row"> <div class="btn-group btn-group-xs" style="padding-right: 10px" role="group"> <button type="button" class="btn btn-default" ng-class="{active:releaseChangeViewType=='change'}" ng-click="switchReleaseChangeViewType('change')">{{'Component.Publish.ToSeeChange' | translate }} </button> <button type="button" class="btn btn-default" ng-class="{active:releaseChangeViewType=='release'}" ng-click="switchReleaseChangeViewType('release')">{{'Component.Publish.PublishedValue' | translate }} </button> </div> </div> </div> <label class="col-sm-2 control-label" ng-if="toReleaseNamespace.isPropertiesFormat">{{'Component.Publish.Changes' | translate }}</label> <div class="col-sm-10" ng-if="(!toReleaseNamespace.isBranch && toReleaseNamespace.itemModifiedCnt) || (toReleaseNamespace.isBranch && toReleaseNamespace.itemModifiedCnt) || (toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length)" valdr-form-group> <!--properties format--> <!--normal release--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && !toReleaseNamespace.isBranch"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th> {{'Component.Publish.PublishedValue' | translate }} </th> <th> {{'Component.Publish.NoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.items" ng-if="config.item.key && config.isModified"> <td width="20%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> <span class="label label-success" ng-if="config.isModified && !config.oldValue" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.NewAddedTips' | translate }}">{{'Component.Publish.NewAdded' | translate }}</span> <span class="label label-info" ng-if="config.isModified && config.oldValue && !config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.ModifiedTips' | translate }}">{{'Component.Publish.Modified' | translate }}</span> <span class="label label-danger" ng-if="config.isDeleted" data-tooltip="tooltip" data-placement="bottom" title="{{'Component.Publish.DeletedTips' | translate }}">{{'Component.Publish.Deleted' | translate }}</span> </td> <td width="25%" title="{{config.oldValue}}"> <span ng-bind="config.oldValue"></span> </td> <td width="25%" title="{{config.newValue}}"> <span ng-bind="config.newValue"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--branch gray release--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th> {{'Component.Publish.MasterValue' | translate }} </th> <th> {{'Component.Publish.GrayPublishedValue' | translate }} </th> <th> {{'Component.Publish.GrayNoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.branchItems" ng-if="config.isModified || config.isDeleted"> <td width="15%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> <span class="label label-danger" ng-show="config.isDeleted">{{'Component.Publish.Deleted' | translate }}</span> </td> <td width="20%" title="{{config.masterReleaseValue}}"> <span ng-bind="config.masterReleaseValue"></span> </td> <td width="20%" title="{{config.oldValue}}"> <span ng-bind="config.oldValue"></span> </td> <td width="20%" title="{{config.newValue}}"> <span ng-bind="config.newValue"></span> </td> <td width="10%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--branch updateAndPublish and publish--> <table class="table table-bordered table-striped text-center table-hover" ng-if="toReleaseNamespace.isPropertiesFormat && toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> <thead> <tr> <th> {{'Component.Publish.Key' | translate }} </th> <th ng-if="toReleaseNamespace.isBranch"> {{'Component.Publish.MasterValue' | translate }} </th> <th ng-if="toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.GrayValue' | translate }} </th> <th ng-if="!toReleaseNamespace.isBranch || !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.PublishedValue' | translate }} </th> <th ng-if="!toReleaseNamespace.isBranch || !toReleaseNamespace.mergeAndPublish"> {{'Component.Publish.NoPublishedValue' | translate }} </th> <th> {{'Component.Publish.ModifyUser' | translate }} </th> <th> {{'Component.Publish.ModifyTime' | translate }} </th> </tr> </thead> <tbody> <tr ng-repeat="config in toReleaseNamespace.branchItems" ng-if="!config.isDeleted"> <td width="20%" title="{{config.item.key}}"> <span ng-bind="config.item.key"></span> </td> <td width="25%" title="{{config.masterReleaseValue}}"> <span ng-bind="config.masterReleaseValue"></span> </td> <td width="25%" title="{{config.item.value}}"> <span ng-bind="config.item.value"></span> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedBy"> </td> <td width="15%" ng-bind="config.item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"> </td> </tr> </tbody> </table> <!--file format --> <div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat" ng-show="releaseChangeViewType=='change'"> <apollodiff old-str="item.oldValue" new-str="item.newValue" apollo-id="'releaseStrDiff'"> </apollodiff> </div> <div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat" ng-show="releaseChangeViewType=='release'"> <textarea class="form-control no-radius" rows="20" ng-disabled="true" ng-show="item.newValue" ng-bind="item.newValue"> </textarea> </div> </div> <div class="col-sm-5" ng-show="(!toReleaseNamespace.isBranch && !toReleaseNamespace.itemModifiedCnt)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.ItemNoChange' | translate }} </label> </div> <div class="col-sm-5" ng-show="(toReleaseNamespace.isBranch && !toReleaseNamespace.mergeAndPublish && !toReleaseNamespace.itemModifiedCnt)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.GrayItemNoChange' | translate }} </label> </div> <div class="col-sm-5" ng-show="(toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length == 0)" valdr-form-group> <label class="form-control-static"> {{'Component.Publish.NoGrayItems' | translate }} </label> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"> <apollorequiredfield></apollorequiredfield> {{'Component.Publish.Release' | translate }} </label> <div class="col-sm-5" valdr-form-group> <input type="text" name="releaseName" class="form-control" placeholder="input release name" ng-model="toReleaseNamespace.releaseTitle" ng-required="true"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">{{'Component.Publish.ReleaseComment' | translate }}</label> <div class="col-sm-10" valdr-form-group> <textarea rows="4" name="comment" class="form-control" style="margin-top: 15px;" ng-model="releaseComment" placeholder="Add an optional extended description..."></textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">{{'Common.Cancel' | translate }}</button> <button type="submit" class="btn btn-primary" ng-disabled="releaseForm.$invalid || releaseBtnDisabled || (toReleaseNamespace.isBranch && toReleaseNamespace.mergeAndPublish && toReleaseNamespace.branchItems.length == 0)"> {{'Component.Publish.OpPublish' | translate }} </button> </div> </div> </div> </form>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Apollo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="keywords" content="apollo,configuration,server,java,microservice" /> <meta name="description" content="A reliable configuration management system" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" /> <meta name="google-site-verification" content="CuvYz6OxISNH7wdJsnS8oNtJJn9IP6k0zz5x6m9uXco" /> <!-- theme --> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css" title="vue" /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dark.css" title="dark" disabled /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/buble.css" title="buble" disabled /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/pure.css" title="pure" disabled /> <style type="text/css"> .sidebar-nav >ul >li.file p >a { font-size: 15px; font-weight: 700; color: #364149; } .sidebar-nav .folder { cursor: pointer; } </style> </head> <body> <div id="app">Loading ...</div> <script> window.$docsify = { alias: { '/': 'zh/README.md', '/zh/.*/_sidebar.md': '/zh/_sidebar.md', '/en/.*/_sidebar.md': '/en/_sidebar.md', '/.*/_navbar.md': '/_navbar.md', '/zh/(.*)': 'zh/$1', '/en/(.*)': 'en/$1', }, auto2top: true, // Only coverpage is loaded when visiting the home page. onlyCover: true, coverpage: true, loadSidebar: true, loadNavbar: true, mergeNavbar: true, maxLevel: 6, subMaxLevel: 5, name: 'Apollo', repo: 'https://github.com/ctripcorp/apollo/', search: { noData: { '/zh/': '没有结果!', '/en/': 'No results!', '/': '没有结果!', }, paths: 'auto', placeholder: { '/zh/': '搜索', '/en/': 'Search', '/': '搜索', }, }, // click to copy. copyCode: { buttonText: { '/zh/': '点击复制', '/en/': 'Copy to clipboard', '/': 'Copy to clipboard', }, errorText: { '/zh/': '错误', '/en/': 'Error', '/': 'Error', }, successText: { '/zh/': '复制成功', '/en': 'Copied', '/': 'Copied', }, }, plugins: [ // Edit Document Button in each page function (hook, vm) { hook.beforeEach(function (html) { if (/githubusercontent\.com/.test(vm.route.file)) { url = vm.route.file .replace('raw.githubusercontent.com', 'github.com') .replace(/\/master/, '/blob/master') } else { url = 'https://github.com/ctripcorp/apollo/blob/master/docs/' + vm.route.file } var editHtml = '[:memo: Edit Document](' + url + ')\n\n' return editHtml + html + '\n\n----\n\n' + '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>' }) }, ], }; </script> <script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script> <!-- plugins --> <!-- support search --> <script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script> <!-- Support docsify sidebar catalog expand and collapse --> <script src="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script> <!-- Medium's image zoom --> <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script> <!-- Add a simple Click to copy button to all preformatted code blocks to effortlessly allow users to copy example code from your docs --> <script src="//cdn.jsdelivr.net/npm/docsify-copy-code"></script> <!-- code highlight --> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-csharp.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-java.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-json.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-properties.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-sql.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-xml-doc.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-yaml.min.js"></script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Apollo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="keywords" content="apollo,configuration,server,java,microservice" /> <meta name="description" content="A reliable configuration management system" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" /> <meta name="google-site-verification" content="CuvYz6OxISNH7wdJsnS8oNtJJn9IP6k0zz5x6m9uXco" /> <!-- theme --> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css" title="vue" /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dark.css" title="dark" disabled /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/buble.css" title="buble" disabled /> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/pure.css" title="pure" disabled /> <style type="text/css"> .sidebar-nav >ul >li.file p >a { font-size: 15px; font-weight: 700; color: #364149; } .sidebar-nav .folder { cursor: pointer; } </style> </head> <body> <div id="app">Loading ...</div> <script> window.$docsify = { alias: { '/': 'zh/README.md', '/zh/.*/_sidebar.md': '/zh/_sidebar.md', '/en/.*/_sidebar.md': '/en/_sidebar.md', '/.*/_navbar.md': '/_navbar.md', '/zh/(.*)': 'zh/$1', '/en/(.*)': 'en/$1', }, auto2top: true, // Only coverpage is loaded when visiting the home page. onlyCover: true, coverpage: true, loadSidebar: true, loadNavbar: true, mergeNavbar: true, maxLevel: 6, subMaxLevel: 5, name: 'Apollo', repo: 'https://github.com/ctripcorp/apollo/', search: { noData: { '/zh/': '没有结果!', '/en/': 'No results!', '/': '没有结果!', }, paths: 'auto', placeholder: { '/zh/': '搜索', '/en/': 'Search', '/': '搜索', }, }, // click to copy. copyCode: { buttonText: { '/zh/': '点击复制', '/en/': 'Copy to clipboard', '/': 'Copy to clipboard', }, errorText: { '/zh/': '错误', '/en/': 'Error', '/': 'Error', }, successText: { '/zh/': '复制成功', '/en': 'Copied', '/': 'Copied', }, }, plugins: [ // Edit Document Button in each page function (hook, vm) { hook.beforeEach(function (html) { if (/githubusercontent\.com/.test(vm.route.file)) { url = vm.route.file .replace('raw.githubusercontent.com', 'github.com') .replace(/\/master/, '/blob/master') } else { url = 'https://github.com/ctripcorp/apollo/blob/master/docs/' + vm.route.file } var editHtml = '[:memo: Edit Document](' + url + ')\n\n' return editHtml + html + '\n\n----\n\n' + '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>' }) }, ], }; </script> <script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script> <!-- plugins --> <!-- support search --> <script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script> <!-- Support docsify sidebar catalog expand and collapse --> <script src="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script> <!-- Medium's image zoom --> <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script> <!-- Add a simple Click to copy button to all preformatted code blocks to effortlessly allow users to copy example code from your docs --> <script src="//cdn.jsdelivr.net/npm/docsify-copy-code"></script> <!-- code highlight --> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-csharp.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-java.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-json.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-properties.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-sql.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-xml-doc.min.js"></script> <script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-yaml.min.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/ctrip_sso_heartbeat.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>SSO Heartbeat</title> <script type="text/javascript"> var reloading = false; setInterval(function () { if (document.cookie.indexOf('memCacheAssertionID=') == -1) { if (reloading) { return; } reloading = true; console.log("sso memCacheAssertionID expires, try reloading"); location.reload(true); } }, 1000); </script> </head> <body> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>SSO Heartbeat</title> <script type="text/javascript"> var reloading = false; setInterval(function () { if (document.cookie.indexOf('memCacheAssertionID=') == -1) { if (reloading) { return; } reloading = true; console.log("sso memCacheAssertionID expires, try reloading"); location.reload(true); } }, 1000); </script> </head> <body> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/publish-deny-modal.html
<div class="modal fade" id="publishDenyModal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">{{'Component.PublishDeny.Title' | translate }}</h4> </div> <div class="modal-body">{{'Component.PublishDeny.Tips1' | translate:this }} <span ng-if="toReleaseNamespace.isEmergencyPublishAllowed"> <br><br><small>{{'Component.PublishDeny.Tips2' | translate }}</small> </span> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal" ng-if="toReleaseNamespace.isEmergencyPublishAllowed" ng-click="emergencyPublish()"> {{'Component.PublishDeny.EmergencyPublish' | translate }} </button> <button type="button" class="btn btn-primary" data-dismiss="modal"> {{'Component.PublishDeny.Close' | translate }} </button> </div> </div> </div> </div>
<div class="modal fade" id="publishDenyModal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">{{'Component.PublishDeny.Title' | translate }}</h4> </div> <div class="modal-body">{{'Component.PublishDeny.Tips1' | translate:this }} <span ng-if="toReleaseNamespace.isEmergencyPublishAllowed"> <br><br><small>{{'Component.PublishDeny.Tips2' | translate }}</small> </span> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal" ng-if="toReleaseNamespace.isEmergencyPublishAllowed" ng-click="emergencyPublish()"> {{'Component.PublishDeny.EmergencyPublish' | translate }} </button> <button type="button" class="btn btn-primary" data-dismiss="modal"> {{'Component.PublishDeny.Close' | translate }} </button> </div> </div> </div> </div>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/common/nav.html
<nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <img class="navbar-brand side-bar-switch cursor-pointer" src="{{ '/img/show_sidebar.png' | prefixPath }}" onMouseOver="this.style.background='#f1f2f7'" onMouseOut="this.style.background='#fff'" data-tooltip="tooltip" data-placement="bottom" title="{{'Common.Nav.ShowNavBar' | translate }}" ng-show="viewMode == 2 && !showSideBar" ng-click="showSideBar = !showSideBar"> <img class="navbar-brand side-bar-switch cursor-pointer" src="{{ '/img/hide_sidebar.png' | prefixPath }}" onMouseOver="this.style.background='#f1f2f7'" onMouseOut="this.style.background='#fff'" data-tooltip="tooltip" data-placement="bottom" title="{{'Common.Nav.HideNavBar' | translate }}" ng-show="viewMode == 2 && showSideBar" ng-click="showSideBar = !showSideBar"> <a class="navbar-brand logo" href="{{ '/' | prefixPath }}"> <img src="{{ '/img/logo-simple.png' | prefixPath }}" style="height:45px; margin-top: -13px"> </a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li> <a href="{{pageSetting.wikiAddress}}" target="_blank"> <span class="glyphicon glyphicon-question-sign"></span> {{'Common.Nav.Help' | translate }} </a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon .glyphicon-glyphicon-font"></span>&nbsp;Language<span class="caret"></span></a> <ul class="dropdown-menu"> <li value="en"><a href="javascript:void(0)" ng-click="changeLanguage('en')">English</a></li> <li value="zh-CN"><a href="javascript:void(0)" ng-click="changeLanguage('zh-CN')">简体中文</a></li> </ul> </li> <!-- admin tool --> <li class="dropdown" ng-if="hasRootPermission == true"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-cog"></span>&nbsp;{{'Common.Nav.AdminTools' | translate }} <span class="caret"></span></a> <ul class="dropdown-menu" > <li><a ng-href="{{ '/user-manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.UserManage' | translate }}</a></li> <li><a href="{{ '/system-role-manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemRoleManage' | translate }}</a></li> <li><a href="{{ '/open/manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.OpenMange' | translate }}</a></li> <li><a href="{{ '/server_config.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemConfig' | translate }}</a></li> <li><a href="{{ '/delete_app_cluster_namespace.html' | prefixPath }}" target="_blank">{{'Common.Nav.DeleteApp-Cluster-Namespace' | translate }}</a></li> <li><a href="{{ '/system_info.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemInfo' | translate }}</a></li> <li><a href="{{ '/config_export.html' | prefixPath }}" target="_blank">{{'Common.Nav.ConfigExport' | translate }}</a></li> </ul> </li> <!-- normal user tool (not admin)--> <li class="dropdown" ng-if="hasRootPermission == false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-cog"></span>&nbsp;{{'Common.Nav.NonAdminTools' | translate }} <span class="caret"></span></a> <ul class="dropdown-menu" > <li><a href="{{ '/config_export.html' | prefixPath }}" target="_blank">{{'Common.Nav.ConfigExport' | translate }}</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-user"></span>&nbsp;{{userName}} <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ '/user/logout' | prefixPath }}">{{'Common.Nav.Logout' | translate }}</a></li> </ul> </li> </ul> <div class="navbar-form navbar-right form-inline" role="search"> <div class="form-group app-search-list"> <select id="app-search-list" style="width: 350px"></select> </div> </div> </div> </div> </nav>
<nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <img class="navbar-brand side-bar-switch cursor-pointer" src="{{ '/img/show_sidebar.png' | prefixPath }}" onMouseOver="this.style.background='#f1f2f7'" onMouseOut="this.style.background='#fff'" data-tooltip="tooltip" data-placement="bottom" title="{{'Common.Nav.ShowNavBar' | translate }}" ng-show="viewMode == 2 && !showSideBar" ng-click="showSideBar = !showSideBar"> <img class="navbar-brand side-bar-switch cursor-pointer" src="{{ '/img/hide_sidebar.png' | prefixPath }}" onMouseOver="this.style.background='#f1f2f7'" onMouseOut="this.style.background='#fff'" data-tooltip="tooltip" data-placement="bottom" title="{{'Common.Nav.HideNavBar' | translate }}" ng-show="viewMode == 2 && showSideBar" ng-click="showSideBar = !showSideBar"> <a class="navbar-brand logo" href="{{ '/' | prefixPath }}"> <img src="{{ '/img/logo-simple.png' | prefixPath }}" style="height:45px; margin-top: -13px"> </a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li> <a href="{{pageSetting.wikiAddress}}" target="_blank"> <span class="glyphicon glyphicon-question-sign"></span> {{'Common.Nav.Help' | translate }} </a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon .glyphicon-glyphicon-font"></span>&nbsp;Language<span class="caret"></span></a> <ul class="dropdown-menu"> <li value="en"><a href="javascript:void(0)" ng-click="changeLanguage('en')">English</a></li> <li value="zh-CN"><a href="javascript:void(0)" ng-click="changeLanguage('zh-CN')">简体中文</a></li> </ul> </li> <!-- admin tool --> <li class="dropdown" ng-if="hasRootPermission == true"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-cog"></span>&nbsp;{{'Common.Nav.AdminTools' | translate }} <span class="caret"></span></a> <ul class="dropdown-menu" > <li><a ng-href="{{ '/user-manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.UserManage' | translate }}</a></li> <li><a href="{{ '/system-role-manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemRoleManage' | translate }}</a></li> <li><a href="{{ '/open/manage.html' | prefixPath }}" target="_blank">{{'Common.Nav.OpenMange' | translate }}</a></li> <li><a href="{{ '/server_config.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemConfig' | translate }}</a></li> <li><a href="{{ '/delete_app_cluster_namespace.html' | prefixPath }}" target="_blank">{{'Common.Nav.DeleteApp-Cluster-Namespace' | translate }}</a></li> <li><a href="{{ '/system_info.html' | prefixPath }}" target="_blank">{{'Common.Nav.SystemInfo' | translate }}</a></li> <li><a href="{{ '/config_export.html' | prefixPath }}" target="_blank">{{'Common.Nav.ConfigExport' | translate }}</a></li> </ul> </li> <!-- normal user tool (not admin)--> <li class="dropdown" ng-if="hasRootPermission == false"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-cog"></span>&nbsp;{{'Common.Nav.NonAdminTools' | translate }} <span class="caret"></span></a> <ul class="dropdown-menu" > <li><a href="{{ '/config_export.html' | prefixPath }}" target="_blank">{{'Common.Nav.ConfigExport' | translate }}</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-user"></span>&nbsp;{{userName}} <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="{{ '/user/logout' | prefixPath }}">{{'Common.Nav.Logout' | translate }}</a></li> </ul> </li> </ul> <div class="navbar-form navbar-right form-inline" role="search"> <div class="form-group app-search-list"> <select id="app-search-list" style="width: 350px"></select> </div> </div> </div> </div> </nav>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/delete-namespace-modal.html
<div id="deleteNamespaceModal" class="modal fade"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"> {{'Component.DeleteNamespace.Title' | translate }} </h4> </div> <div class="modal-body form-horizontal" ng-show="toDeleteNamespace.isPublic"> {{'Component.DeleteNamespace.PublicContent' | translate }} </div> <div class="modal-body form-horizontal" ng-show="!toDeleteNamespace.isPublic"> {{'Component.DeleteNamespace.PrivateContent' | translate }} </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> {{'Common.Cancel' | translate }} </button> <button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="doDeleteNamespace()"> {{'Common.Ok' | translate }} </button> </div> </div> </div> </div>
<div id="deleteNamespaceModal" class="modal fade"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"> {{'Component.DeleteNamespace.Title' | translate }} </h4> </div> <div class="modal-body form-horizontal" ng-show="toDeleteNamespace.isPublic"> {{'Component.DeleteNamespace.PublicContent' | translate }} </div> <div class="modal-body form-horizontal" ng-show="!toDeleteNamespace.isPublic"> {{'Component.DeleteNamespace.PrivateContent' | translate }} </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> {{'Common.Cancel' | translate }} </button> <button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="doDeleteNamespace()"> {{'Common.Ok' | translate }} </button> </div> </div> </div> </div>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/views/component/merge-and-publish-modal.html
<div class="modal fade" id="mergeAndPublishModal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">{{'Component.MergePublish.Title' | translate }}</h4> </div> <div class="modal-body"> {{'Component.MergePublish.Tips' | translate }} <br> <h5>{{'Component.MergePublish.NextStep' | translate }}</h5> <div class="radio"> <label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'true'"> <input type="radio" name="deleteBranch" ng-checked="!toReleaseNamespace.mergeAfterDeleteBranch || toReleaseNamespace.mergeAfterDeleteBranch == 'true'"> {{'Component.MergePublish.DeleteGrayscale' | translate }} </label> </div> <div class="radio"> <label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'false'"> <input type="radio" name="deleteBranch" ng-checked="toReleaseNamespace.mergeAfterDeleteBranch == 'false'"> {{'Component.MergePublish.ReservedGrayscale' | translate }} </label> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">{{'Common.Cancel' | translate }}</button> <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="showReleaseModal()"> {{'Common.Ok' | translate }} </button> </div> </div> </div> </div>
<div class="modal fade" id="mergeAndPublishModal" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header panel-primary"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">{{'Component.MergePublish.Title' | translate }}</h4> </div> <div class="modal-body"> {{'Component.MergePublish.Tips' | translate }} <br> <h5>{{'Component.MergePublish.NextStep' | translate }}</h5> <div class="radio"> <label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'true'"> <input type="radio" name="deleteBranch" ng-checked="!toReleaseNamespace.mergeAfterDeleteBranch || toReleaseNamespace.mergeAfterDeleteBranch == 'true'"> {{'Component.MergePublish.DeleteGrayscale' | translate }} </label> </div> <div class="radio"> <label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'false'"> <input type="radio" name="deleteBranch" ng-checked="toReleaseNamespace.mergeAfterDeleteBranch == 'false'"> {{'Component.MergePublish.ReservedGrayscale' | translate }} </label> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">{{'Common.Cancel' | translate }}</button> <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="showReleaseModal()"> {{'Common.Ok' | translate }} </button> </div> </div> </div> </div>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/config/sync.html
<!doctype html> <html ng-app="sync_item"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Config.Sync.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container hidden" ng-controller="SyncItemController"> <section class="panel col-md-offset-1 col-md-10"> <header class="panel-heading"> <div class="row"> <div class="col-md-7"> <h4 class="modal-title">{{'Config.Sync.Title' | translate }} <small ng-show="syncItemStep == 1">{{'Config.Sync.FistStep' | translate }}</small> <small ng-show="syncItemStep == 2">{{'Config.Sync.SecondStep' | translate }}</small> </h4> </div> <div class="col-md-5 text-right"> <button type="button" class="btn btn-primary" ng-show="syncItemStep > 1 && syncItemStep < 3" ng-click="syncItemNextStep(-1)">{{'Config.Sync.PreviousStep' | translate }} </button> <button type="button" class="btn btn-primary" ng-show="syncItemStep < 2" ng-click="diff()">{{'Config.Sync.NextStep' | translate }} </button> <button type="button" class="btn btn-success" ng-show="syncItemStep == 2 && hasDiff" ng-click="syncItems()" ng-disabled="syncBtnDisabled">{{'Config.Sync.Sync' | translate }} </button> <button type="button" class="btn btn-info" data-dismiss="modal" ng-click="backToAppHomePage()">{{'Common.ReturnToIndex' | translate }} </button> </div> </div> </header> <div class="panel-body"> <div class="row" ng-show="syncItemStep == 1"> <div class="alert-info alert no-radius"> <strong>{{'Config.Sync.Tips' | translate }}:</strong> <ul> <li>{{'Config.Sync.Tips1' | translate }}</li> <li>{{'Config.Sync.Tips2' | translate }}</li> </ul> </div> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Config.Sync.SyncNamespace' | translate }}</label> <div class="col-sm-6"> <h4 ng-bind="pageContext.namespaceName"></h4> </div> </div> </div> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Config.Sync.SyncToCluster' | translate }}</label> <div class="col-sm-6"> <apolloclusterselector apollo-app-id="pageContext.appId" apollo-default-all-checked="true" apollo-select="collectSelectedClusters" apollo-not-checked-env="pageContext.env" apollo-not-checked-cluster="pageContext.clusterName"></apolloclusterselector> </div> </div> </div> <hr> </div> <div class="row" ng-show="syncItemStep == 1" style="margin-top: 10px;"> <div class="form-horizontal"> <div class="col-sm-2 text-right"> <label class="control-label">{{'Config.Sync.NeedToSyncItem' | translate }}</label> </div> <div class="col-sm-10"> <div class="row text-right" style="margin-bottom: 5px; margin-right: 0px;"> {{'Config.Sync.SortByLastModifyTime' | translate }} {{'Config.Sync.BeginTime' | translate }}:<input type="date" ng-model="filterBeginTime"> {{'Config.Sync.EndTime' | translate }}: <input type="date" ng-model="filterEndTime"> <button class="btn btn-sm btn-primary" ng-click="filter()">{{'Config.Sync.Filter' | translate }}</button> <button class="btn btn-sm btn-default" ng-click="resetFilter()">{{'Config.Sync.Rest' | translate }}</button> </div> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <td><input type="checkbox" ng-click="toggleItemsCheckedStatus()"></td> <td class="hover" ng-click="col='key';desc=!desc;"> {{'Config.Sync.ItemKey' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> <td>{{'Config.Sync.ItemValue' | translate }}</td> <td class="hover" ng-click="col='dataChangeCreatedTime';desc=!desc;"> {{'Config.Sync.ItemCreateTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> <td class="hover" ng-click="col='dataChangeLastModifiedTime';desc=!desc;"> {{'Config.Sync.ItemUpdateTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> </tr> </thead> <tbody> <tr ng-repeat="item in viewItems|orderBy:col:desc"> <td width="10%"><input type="checkbox" ng-checked="item.checked" ng-click="switchSelect(item)"></td> <td width="20%"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' : ''"></span> </td> <td class="cursor-pointer" width="40%" ng-click="showText(item.value)"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...' : ''"></span> </td> <td width="15%"> <span ng-bind="item.dataChangeCreatedTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> </td> <td width="15%"> <span ng-bind="item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> </td> </tr> </tbody> </table> </div> </div> </div> <!--step 2--> <div class="row" ng-show="syncItemStep == 2" ng-repeat="clusterDiff in clusterDiffs"> <h4 class="text-center"> {{'Common.Environment' | translate }}:<span ng-bind="clusterDiff.namespace.env"></span> {{'Common.Cluster' | translate }}:<span ng-bind="clusterDiff.namespace.clusterName"></span> <span ng-show="!clusterDiff.extInfo">{{'Common.Namespace' | translate }}:{{pageContext.namespaceName}}</span> </h4> <div class="text-center" ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 || clusterDiff.extInfo"> <span ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 && !clusterDiff.extInfo">{{'Config.Sync.NoNeedSyncItem' | translate }}</span> <span ng-show="clusterDiff.extInfo" ng-bind="clusterDiff.extInfo"></span>, {{'Config.Sync.IgnoreSync' | translate }} </div> <div class="row" style="margin-top: 10px;" ng-show="clusterDiff.diffs.updateItems.length + clusterDiff.diffs.createItems.length > 0"> <div class="form-horizontal"> <div class="col-sm-12"> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <td>{{'Config.Sync.Step2Type' | translate }}</td> <td>{{'Config.Sync.Step2Key' | translate }}</td> <td>{{'Config.Sync.Step2SyncBefore' | translate }}</td> <td>{{'Config.Sync.Step2SyncAfter' | translate }}</td> <td>{{'Config.Sync.Step2Comment' | translate }}</td> <td>{{'Config.Sync.Step2Operator' | translate }}</td> </tr> </thead> <tbody> <tr ng-repeat="createItem in clusterDiff.diffs.createItems"> <td width="5%">{{'Config.Sync.NewAdd' | translate }}</td> <td width="15%" ng-bind="createItem.key"></td> <td width="30%"></td> <td width="30%" ng-bind="createItem.value"></td> <td width="15%" ng-bind="createItem.comment"></td> <td width="5%"> <a data-tooltip="tooltip" data-placement="bottom" title="{{'Config.Sync.NoSyncItem' | translate }}" ng-click="removeItem(clusterDiff.diffs, 'create', createItem)">{{'Config.Sync.Delete' | translate }}</a> </td> </tr> <tr ng-repeat="updateItem in clusterDiff.diffs.updateItems"> <td width="5%">{{'Config.Sync.Update' | translate }}</td> <td width="15%" ng-bind="updateItem.key"></td> <td width="30%" ng-bind="updateItem.oldValue"></td> <td width="30%" ng-bind="updateItem.value"></td> <td width="15%" ng-bind="updateItem.comment"></td> <td width="5%"> <a data-tooltip="tooltip" data-placement="bottom" title="{{'Config.Sync.NoSyncItem' | translate }}" ng-click="removeItem(clusterDiff.diffs, 'update', updateItem)">{{'Config.Sync.Delete' | translate }}</a> </td> </tr> </tbody> </table> </div> </div> </div> </div> <!--step 3--> <div class="row text-center" ng-show="syncItemStep == 3 && syncSuccess"> <img src="../img/sync-succ.png" style="height: 100px; width: 100px"> <h3>{{'Config.Sync.SyncSuccessfully' | translate }}</h3> </div> <div class="row text-center" ng-show="syncItemStep == 3 && !syncSuccess"> <img src="../img/sync-error.png" style="height: 100px; width: 100px"> <h3>{{'Config.Sync.SyncFailed' | translate }}</h3> </div> </div> </section> <showtextmodal text="text" /> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/clipboard.min.js" type="text/javascript"></script> <!--biz--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/ConfigService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/controller/config/SyncConfigController.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script> </body> </html>
<!doctype html> <html ng-app="sync_item"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="../img/config.png"> <!-- styles --> <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css"> <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" href="../styles/common-style.css"> <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css"> <title>{{'Config.Sync.Title' | translate }}</title> </head> <body> <apollonav></apollonav> <div class="container-fluid apollo-container hidden" ng-controller="SyncItemController"> <section class="panel col-md-offset-1 col-md-10"> <header class="panel-heading"> <div class="row"> <div class="col-md-7"> <h4 class="modal-title">{{'Config.Sync.Title' | translate }} <small ng-show="syncItemStep == 1">{{'Config.Sync.FistStep' | translate }}</small> <small ng-show="syncItemStep == 2">{{'Config.Sync.SecondStep' | translate }}</small> </h4> </div> <div class="col-md-5 text-right"> <button type="button" class="btn btn-primary" ng-show="syncItemStep > 1 && syncItemStep < 3" ng-click="syncItemNextStep(-1)">{{'Config.Sync.PreviousStep' | translate }} </button> <button type="button" class="btn btn-primary" ng-show="syncItemStep < 2" ng-click="diff()">{{'Config.Sync.NextStep' | translate }} </button> <button type="button" class="btn btn-success" ng-show="syncItemStep == 2 && hasDiff" ng-click="syncItems()" ng-disabled="syncBtnDisabled">{{'Config.Sync.Sync' | translate }} </button> <button type="button" class="btn btn-info" data-dismiss="modal" ng-click="backToAppHomePage()">{{'Common.ReturnToIndex' | translate }} </button> </div> </div> </header> <div class="panel-body"> <div class="row" ng-show="syncItemStep == 1"> <div class="alert-info alert no-radius"> <strong>{{'Config.Sync.Tips' | translate }}:</strong> <ul> <li>{{'Config.Sync.Tips1' | translate }}</li> <li>{{'Config.Sync.Tips2' | translate }}</li> </ul> </div> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Config.Sync.SyncNamespace' | translate }}</label> <div class="col-sm-6"> <h4 ng-bind="pageContext.namespaceName"></h4> </div> </div> </div> <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">{{'Config.Sync.SyncToCluster' | translate }}</label> <div class="col-sm-6"> <apolloclusterselector apollo-app-id="pageContext.appId" apollo-default-all-checked="true" apollo-select="collectSelectedClusters" apollo-not-checked-env="pageContext.env" apollo-not-checked-cluster="pageContext.clusterName"></apolloclusterselector> </div> </div> </div> <hr> </div> <div class="row" ng-show="syncItemStep == 1" style="margin-top: 10px;"> <div class="form-horizontal"> <div class="col-sm-2 text-right"> <label class="control-label">{{'Config.Sync.NeedToSyncItem' | translate }}</label> </div> <div class="col-sm-10"> <div class="row text-right" style="margin-bottom: 5px; margin-right: 0px;"> {{'Config.Sync.SortByLastModifyTime' | translate }} {{'Config.Sync.BeginTime' | translate }}:<input type="date" ng-model="filterBeginTime"> {{'Config.Sync.EndTime' | translate }}: <input type="date" ng-model="filterEndTime"> <button class="btn btn-sm btn-primary" ng-click="filter()">{{'Config.Sync.Filter' | translate }}</button> <button class="btn btn-sm btn-default" ng-click="resetFilter()">{{'Config.Sync.Rest' | translate }}</button> </div> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <td><input type="checkbox" ng-click="toggleItemsCheckedStatus()"></td> <td class="hover" ng-click="col='key';desc=!desc;"> {{'Config.Sync.ItemKey' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> <td>{{'Config.Sync.ItemValue' | translate }}</td> <td class="hover" ng-click="col='dataChangeCreatedTime';desc=!desc;"> {{'Config.Sync.ItemCreateTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> <td class="hover" ng-click="col='dataChangeLastModifiedTime';desc=!desc;"> {{'Config.Sync.ItemUpdateTime' | translate }} <span class="glyphicon glyphicon-sort"></span> </td> </tr> </thead> <tbody> <tr ng-repeat="item in viewItems|orderBy:col:desc"> <td width="10%"><input type="checkbox" ng-checked="item.checked" ng-click="switchSelect(item)"></td> <td width="20%"> <span ng-bind="item.key | limitTo: 250"></span> <span ng-bind="item.key.length > 250 ? '...' : ''"></span> </td> <td class="cursor-pointer" width="40%" ng-click="showText(item.value)"> <span ng-bind="item.value | limitTo: 250"></span> <span ng-bind="item.value.length > 250 ? '...' : ''"></span> </td> <td width="15%"> <span ng-bind="item.dataChangeCreatedTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> </td> <td width="15%"> <span ng-bind="item.dataChangeLastModifiedTime | date: 'yyyy-MM-dd HH:mm:ss'"></span> </td> </tr> </tbody> </table> </div> </div> </div> <!--step 2--> <div class="row" ng-show="syncItemStep == 2" ng-repeat="clusterDiff in clusterDiffs"> <h4 class="text-center"> {{'Common.Environment' | translate }}:<span ng-bind="clusterDiff.namespace.env"></span> {{'Common.Cluster' | translate }}:<span ng-bind="clusterDiff.namespace.clusterName"></span> <span ng-show="!clusterDiff.extInfo">{{'Common.Namespace' | translate }}:{{pageContext.namespaceName}}</span> </h4> <div class="text-center" ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 || clusterDiff.extInfo"> <span ng-show="clusterDiff.diffs.createItems.length + clusterDiff.diffs.updateItems.length == 0 && !clusterDiff.extInfo">{{'Config.Sync.NoNeedSyncItem' | translate }}</span> <span ng-show="clusterDiff.extInfo" ng-bind="clusterDiff.extInfo"></span>, {{'Config.Sync.IgnoreSync' | translate }} </div> <div class="row" style="margin-top: 10px;" ng-show="clusterDiff.diffs.updateItems.length + clusterDiff.diffs.createItems.length > 0"> <div class="form-horizontal"> <div class="col-sm-12"> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <td>{{'Config.Sync.Step2Type' | translate }}</td> <td>{{'Config.Sync.Step2Key' | translate }}</td> <td>{{'Config.Sync.Step2SyncBefore' | translate }}</td> <td>{{'Config.Sync.Step2SyncAfter' | translate }}</td> <td>{{'Config.Sync.Step2Comment' | translate }}</td> <td>{{'Config.Sync.Step2Operator' | translate }}</td> </tr> </thead> <tbody> <tr ng-repeat="createItem in clusterDiff.diffs.createItems"> <td width="5%">{{'Config.Sync.NewAdd' | translate }}</td> <td width="15%" ng-bind="createItem.key"></td> <td width="30%"></td> <td width="30%" ng-bind="createItem.value"></td> <td width="15%" ng-bind="createItem.comment"></td> <td width="5%"> <a data-tooltip="tooltip" data-placement="bottom" title="{{'Config.Sync.NoSyncItem' | translate }}" ng-click="removeItem(clusterDiff.diffs, 'create', createItem)">{{'Config.Sync.Delete' | translate }}</a> </td> </tr> <tr ng-repeat="updateItem in clusterDiff.diffs.updateItems"> <td width="5%">{{'Config.Sync.Update' | translate }}</td> <td width="15%" ng-bind="updateItem.key"></td> <td width="30%" ng-bind="updateItem.oldValue"></td> <td width="30%" ng-bind="updateItem.value"></td> <td width="15%" ng-bind="updateItem.comment"></td> <td width="5%"> <a data-tooltip="tooltip" data-placement="bottom" title="{{'Config.Sync.NoSyncItem' | translate }}" ng-click="removeItem(clusterDiff.diffs, 'update', updateItem)">{{'Config.Sync.Delete' | translate }}</a> </td> </tr> </tbody> </table> </div> </div> </div> </div> <!--step 3--> <div class="row text-center" ng-show="syncItemStep == 3 && syncSuccess"> <img src="../img/sync-succ.png" style="height: 100px; width: 100px"> <h3>{{'Config.Sync.SyncSuccessfully' | translate }}</h3> </div> <div class="row text-center" ng-show="syncItemStep == 3 && !syncSuccess"> <img src="../img/sync-error.png" style="height: 100px; width: 100px"> <h3>{{'Config.Sync.SyncFailed' | translate }}</h3> </div> </div> </section> <showtextmodal text="text" /> </div> <div ng-include="'../views/common/footer.html'"></div> <!-- jquery.js --> <script src="../vendor/jquery.min.js" type="text/javascript"></script> <script src="../vendor/select2/select2.min.js" type="text/javascript"></script> <!--angular--> <script src="../vendor/angular/angular.min.js"></script> <script src="../vendor/angular/angular-resource.min.js"></script> <script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="../vendor/angular/loading-bar.min.js"></script> <script src="../vendor/angular/angular-cookies.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="../vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <!-- bootstrap.js --> <script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="../vendor/clipboard.min.js" type="text/javascript"></script> <!--biz--> <script type="application/javascript" src="../scripts/app.js"></script> <script type="application/javascript" src="../scripts/services/AppService.js"></script> <script type="application/javascript" src="../scripts/services/EnvService.js"></script> <script type="application/javascript" src="../scripts/services/ConfigService.js"></script> <script type="application/javascript" src="../scripts/services/UserService.js"></script> <script type="application/javascript" src="../scripts/services/CommonService.js"></script> <script type="application/javascript" src="../scripts/services/PermissionService.js"></script> <script type="application/javascript" src="../scripts/AppUtils.js"></script> <script type="application/javascript" src="../scripts/controller/config/SyncConfigController.js"></script> <script type="application/javascript" src="../scripts/PageCommon.js"></script> <script type="application/javascript" src="../scripts/directive/directive.js"></script> <script type="application/javascript" src="../scripts/directive/show-text-modal-directive.js"></script> </body> </html>
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java
package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "Privilege") @SQLDelete(sql = "Update Privilege set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Privilege extends BaseEntity { @Column(name = "Name", nullable = false) private String name; @Column(name = "PrivilType", nullable = false) private String privilType; @Column(name = "NamespaceId") private long namespaceId; public String getName() { return name; } public long getNamespaceId() { return namespaceId; } public String getPrivilType() { return privilType; } public void setName(String name) { this.name = name; } public void setNamespaceId(long namespaceId) { this.namespaceId = namespaceId; } public void setPrivilType(String privilType) { this.privilType = privilType; } public String toString() { return toStringHelper().add("namespaceId", namespaceId).add("privilType", privilType) .add("name", name).toString(); } }
package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "Privilege") @SQLDelete(sql = "Update Privilege set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Privilege extends BaseEntity { @Column(name = "Name", nullable = false) private String name; @Column(name = "PrivilType", nullable = false) private String privilType; @Column(name = "NamespaceId") private long namespaceId; public String getName() { return name; } public long getNamespaceId() { return namespaceId; } public String getPrivilType() { return privilType; } public void setName(String name) { this.name = name; } public void setNamespaceId(long namespaceId) { this.namespaceId = namespaceId; } public void setPrivilType(String privilType) { this.privilType = privilType; } public String toString() { return toStringHelper().add("namespaceId", namespaceId).add("privilType", privilType) .add("name", name).toString(); } }
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/vendor/ui-ace/mode-json.js
define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/cstyle").FoldMode,f=e("../worker/worker_client").WorkerClient,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f(["ace"],"ace/mode/json_worker","JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(l.prototype),t.Mode=l})
define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/cstyle").FoldMode,f=e("../worker/worker_client").WorkerClient,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f(["ace"],"ace/mode/json_worker","JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(l.prototype),t.Mode=l})
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./doc/images/tech-support-qq-1.png
PNG  IHDR.."h"IDATx pTqNQ5TڋBt[࠴"Ej͵#ނ2 kQ1IbDjA y )MLSHTr'OMȞsv{?g=rvfB8E/B! B QT(PBEB (*P(DQEB! (* QT(DQPB! B QT(PBEB (*P(DQœim>a{5ڶc((((((((('C1C>V|J#QwQEQEQEQEQEQ$((9gĎF1EQEQEQ1&((cLEQE1</{N鄰֢(((((((((^/S+\cʋ(((((((((v4ac3 ۔Cb|0{(((((((((sC6c(FEQۈ(EQ6(mD1"v~Nh IQEQEQEQEQEQEQEQEQo>>|U@ EQEQEQEQEQEQEQEQEQ uN8ݣ5l}EQEQEQEQEQEQEQEQEQ/ط$Q'!i$((((((((bɌz|q+(((((((('C?l& D92tpQEQEQEQEQEQEQEQEQLɌMT9Ɍzx4EQEQEQEQE[_+++;rsQEQlgڵkכo[jU<DQ C؁(}ZZy(i-!ŐP7c<ׁEQ{x (vt3g q@5DQ;(޽{]6<J(o~Pġ+,X9"vNئj2C+((@}V~T!'J5"7((wߧlYUյn<؀ؘpG.(mHn&=?px/ZU w4bGɻNoddd᱐Cs5ַV񅝰+vn,0E)Qv’{NCvyOEQ 5=z466!wԶ/Boa<Ժrc#OGE1.)G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B! B QT(PBEB (*P(bZqIENDB`
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-common/src/main/resources/application.properties
spring.mvc.converters.preferred-json-mapper=gson # DataSource spring.datasource.hikari.connectionInitSql=set names utf8mb4 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Naming strategy spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl spring.jpa.hibernate.globally_quoted_identifiers=true spring.jpa.properties.hibernate.globally_quoted_identifiers=true # Tomcat configuration server.tomcat.accept-count=5000 # Increase tomcat header size for longer GET query parameter, should be n * 1024 server.max-http-header-size=10240 # Spring Boot 2.x management.endpoints.web.base-path=/ logging.logback.rollingpolicy.max-file-size=50MB logging.logback.rollingpolicy.max-history=10 management.endpoints.web.exposure.include=info,health,metrics,prometheus # Project information spring.info.git.location=classpath:apollo-git.properties
spring.mvc.converters.preferred-json-mapper=gson # DataSource spring.datasource.hikari.connectionInitSql=set names utf8mb4 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Naming strategy spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl spring.jpa.hibernate.globally_quoted_identifiers=true spring.jpa.properties.hibernate.globally_quoted_identifiers=true # Tomcat configuration server.tomcat.accept-count=5000 # Increase tomcat header size for longer GET query parameter, should be n * 1024 server.max-http-header-size=10240 # Spring Boot 2.x management.endpoints.web.base-path=/ logging.logback.rollingpolicy.max-file-size=50MB logging.logback.rollingpolicy.max-history=10 management.endpoints.web.exposure.include=info,health,metrics,prometheus # Project information spring.info.git.location=classpath:apollo-git.properties
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/scripts/controller/AppController.js
app_module.controller('CreateAppController', ['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService', createAppController]); function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) { $scope.app = {}; $scope.submitBtnDisabled = false; $scope.create = create; init(); function init() { initOrganization(); initSystemRole(); } function initOrganization() { OrganizationService.find_organizations().then(function (result) { var organizations = []; result.forEach(function (item) { var org = {}; org.id = item.orgId; org.text = item.orgName + '(' + item.orgId + ')'; org.name = item.orgName; organizations.push(org); }); $('#organization').select2({ placeholder: $translate.instant('Common.PleaseChooseDepartment'), width: '100%', data: organizations }); }, function (result) { toastr.error(AppUtil.errorMsg(result), "load organizations error"); }); } function initSystemRole() { SystemRoleService.has_open_manage_app_master_role_limit().then( function (value) { $scope.isOpenManageAppMasterRoleLimit = value.isManageAppMasterPermissionEnabled; UserService.load_user().then( function (value1) { $scope.currentUser = value1; }, function (reason) { toastr.error(AppUtil.errorMsg(reason), "load current user info failed"); }) }, function (reason) { toastr.error(AppUtil.errorMsg(reason), "init system role of manageAppMaster failed"); } ); } function create() { $scope.submitBtnDisabled = true; var selectedOrg = $('#organization').select2('data')[0]; if (!selectedOrg.id) { toastr.warning($translate.instant('Common.PleaseChooseDepartment')); $scope.submitBtnDisabled = false; return; } $scope.app.orgId = selectedOrg.id; $scope.app.orgName = selectedOrg.name; // owner var owner = $('.ownerSelector').select2('data')[0]; if ($scope.isOpenManageAppMasterRoleLimit) { owner = { id: $scope.currentUser.userId }; } if (!owner) { toastr.warning($translate.instant('Common.PleaseChooseOwner')); $scope.submitBtnDisabled = false; return; } $scope.app.ownerName = owner.id; //admins $scope.app.admins = []; var admins = $(".adminSelector").select2('data'); if ($scope.isOpenManageAppMasterRoleLimit) { admins = [{ id: $scope.currentUser.userId }]; } if (admins) { admins.forEach(function (admin) { $scope.app.admins.push(admin.id); }) } AppService.create($scope.app).then(function (result) { toastr.success($translate.instant('Common.Created')); setInterval(function () { $scope.submitBtnDisabled = false; $window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + result.appId; }, 1000); }, function (result) { $scope.submitBtnDisabled = false; toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed')); }); } $(".J_ownerSelectorPanel").on("select2:select", ".ownerSelector", selectEventHandler); var $adminSelectorPanel = $(".J_adminSelectorPanel"); $adminSelectorPanel.on("select2:select", ".adminSelector", selectEventHandler); $adminSelectorPanel.on("select2:unselect", ".adminSelector", selectEventHandler); function selectEventHandler() { $('.J_owner').remove(); var owner = $('.ownerSelector').select2('data')[0]; if (owner) { $(".adminSelector").parent().find(".select2-selection__rendered").prepend( '<li class="select2-selection__choice J_owner">' + _.escape(owner.text) + '</li>') } } }
app_module.controller('CreateAppController', ['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService', createAppController]); function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) { $scope.app = {}; $scope.submitBtnDisabled = false; $scope.create = create; init(); function init() { initOrganization(); initSystemRole(); } function initOrganization() { OrganizationService.find_organizations().then(function (result) { var organizations = []; result.forEach(function (item) { var org = {}; org.id = item.orgId; org.text = item.orgName + '(' + item.orgId + ')'; org.name = item.orgName; organizations.push(org); }); $('#organization').select2({ placeholder: $translate.instant('Common.PleaseChooseDepartment'), width: '100%', data: organizations }); }, function (result) { toastr.error(AppUtil.errorMsg(result), "load organizations error"); }); } function initSystemRole() { SystemRoleService.has_open_manage_app_master_role_limit().then( function (value) { $scope.isOpenManageAppMasterRoleLimit = value.isManageAppMasterPermissionEnabled; UserService.load_user().then( function (value1) { $scope.currentUser = value1; }, function (reason) { toastr.error(AppUtil.errorMsg(reason), "load current user info failed"); }) }, function (reason) { toastr.error(AppUtil.errorMsg(reason), "init system role of manageAppMaster failed"); } ); } function create() { $scope.submitBtnDisabled = true; var selectedOrg = $('#organization').select2('data')[0]; if (!selectedOrg.id) { toastr.warning($translate.instant('Common.PleaseChooseDepartment')); $scope.submitBtnDisabled = false; return; } $scope.app.orgId = selectedOrg.id; $scope.app.orgName = selectedOrg.name; // owner var owner = $('.ownerSelector').select2('data')[0]; if ($scope.isOpenManageAppMasterRoleLimit) { owner = { id: $scope.currentUser.userId }; } if (!owner) { toastr.warning($translate.instant('Common.PleaseChooseOwner')); $scope.submitBtnDisabled = false; return; } $scope.app.ownerName = owner.id; //admins $scope.app.admins = []; var admins = $(".adminSelector").select2('data'); if ($scope.isOpenManageAppMasterRoleLimit) { admins = [{ id: $scope.currentUser.userId }]; } if (admins) { admins.forEach(function (admin) { $scope.app.admins.push(admin.id); }) } AppService.create($scope.app).then(function (result) { toastr.success($translate.instant('Common.Created')); setInterval(function () { $scope.submitBtnDisabled = false; $window.location.href = AppUtil.prefixPath() + '/config.html?#appid=' + result.appId; }, 1000); }, function (result) { $scope.submitBtnDisabled = false; toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed')); }); } $(".J_ownerSelectorPanel").on("select2:select", ".ownerSelector", selectEventHandler); var $adminSelectorPanel = $(".J_adminSelectorPanel"); $adminSelectorPanel.on("select2:select", ".adminSelector", selectEventHandler); $adminSelectorPanel.on("select2:unselect", ".adminSelector", selectEventHandler); function selectEventHandler() { $('.J_owner').remove(); var owner = $('.ownerSelector').select2('data')[0]; if (owner) { $(".adminSelector").parent().find(".select2-selection__rendered").prepend( '<li class="select2-selection__choice J_owner">' + _.escape(owner.text) + '</li>') } } }
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/img/branch.png
PNG  IHDRXIDATx^_vRI +B y0f\d ̬@o +0yLܮcV^vuwU_U뭇p_>U@AHE!LfD4HЬ,ϪNs lB`#'ע;u. h H@Z kA?SgdD> FAw:$M=J0(5 蝱HБxC/Ͻ@d|gI$\"xg*oQR{}0MSm1/Yqaeʌ ˌz} է@:G>)귶0$^GWDMƅñ>C ֙!ֹu4@G箖q*R-OrAjg<?x}'pԀs@FTOHOYG6h<ӀS@bZ/xݞ jJܣ`tg2to9eX'{}9{l aw7SO5u>x-J$N?wZgpHzmbg2X0뀤GJw}B4Oֽ0CFX ëUǼ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&CZ?<J@={4ERéOxøx(6iGAwNU% ɺ(N s҅;E;Awh1E&d{S:4l&Y΢HQD֪};]k] DD bU|bZZhO*z@ԎrEݏִހ?ھwuͯoTĞ MI#ԆA\,Fm8,aFt2xfFRK|T6uԀlDiqtjz>%X֊. )$&f4`q$>G3NlRz)Hb҅ʶ}줴0$fٔtĔfUw!eW,+>gu HN)6?(bߍ.#_2 -hݡ6T̀8eyƻ z y$nzCW8ume%϶-e@kKd@2r,PcF3@ H'(PS4O- fRO~ )7Chadr D3 .ę|E]jAbbҠeGpݥxeّMU^Ք|r]`@\Z^s:RaknRqqW =_m4R܄H1<Ƶ5hcIt' {Nssqg#5si "OeĈZ}֪WݶXVU~ޗ9C {WFԼCވUf@_%ki0ՒO S <#CyI)}ɀ`JjɎ|VFa0~Ncr-Z9x炓.{.|Y C{e\)D˧8/Fغn ݲ=v6QGZ \|%[^ (4U1 Y`{u^tK /a(C,hY^mۇ `R5#ir#_WȓA%MIENDB`
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-mysql-for-apollo-test-beta-env.yaml
--- kind: Service apiVersion: v1 metadata: namespace: sre name: service-mysql-for-apollo-test-beta-env labels: app: service-mysql-for-apollo-test-beta-env spec: ports: - protocol: TCP port: 3306 targetPort: 3306 type: ClusterIP sessionAffinity: None --- kind: Endpoints apiVersion: v1 metadata: namespace: sre name: service-mysql-for-apollo-test-beta-env subsets: - addresses: - ip: your-mysql-addresses ports: - protocol: TCP port: 3306
--- kind: Service apiVersion: v1 metadata: namespace: sre name: service-mysql-for-apollo-test-beta-env labels: app: service-mysql-for-apollo-test-beta-env spec: ports: - protocol: TCP port: 3306 targetPort: 3306 type: ClusterIP sessionAffinity: None --- kind: Endpoints apiVersion: v1 metadata: namespace: sre name: service-mysql-for-apollo-test-beta-env subsets: - addresses: - ip: your-mysql-addresses ports: - protocol: TCP port: 3306
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolver.java
package com.ctrip.framework.apollo.portal.component.txtresolver; import com.ctrip.framework.apollo.common.dto.ItemChangeSets; import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.StringUtils; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component("fileTextResolver") public class FileTextResolver implements ConfigTextResolver { @Override public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) { ItemChangeSets changeSets = new ItemChangeSets(); if (CollectionUtils.isEmpty(baseItems) && StringUtils.isEmpty(configText)) { return changeSets; } if (CollectionUtils.isEmpty(baseItems)) { changeSets.addCreateItem(createItem(namespaceId, 0, configText)); } else { ItemDTO beforeItem = baseItems.get(0); if (!configText.equals(beforeItem.getValue())) {//update changeSets.addUpdateItem(createItem(namespaceId, beforeItem.getId(), configText)); } } return changeSets; } private ItemDTO createItem(long namespaceId, long itemId, String value) { ItemDTO item = new ItemDTO(); item.setId(itemId); item.setNamespaceId(namespaceId); item.setValue(value); item.setLineNum(1); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return item; } }
package com.ctrip.framework.apollo.portal.component.txtresolver; import com.ctrip.framework.apollo.common.dto.ItemChangeSets; import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.StringUtils; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component("fileTextResolver") public class FileTextResolver implements ConfigTextResolver { @Override public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) { ItemChangeSets changeSets = new ItemChangeSets(); if (CollectionUtils.isEmpty(baseItems) && StringUtils.isEmpty(configText)) { return changeSets; } if (CollectionUtils.isEmpty(baseItems)) { changeSets.addCreateItem(createItem(namespaceId, 0, configText)); } else { ItemDTO beforeItem = baseItems.get(0); if (!configText.equals(beforeItem.getValue())) {//update changeSets.addUpdateItem(createItem(namespaceId, beforeItem.getId(), configText)); } } return changeSets; } private ItemDTO createItem(long namespaceId, long itemId, String value) { ItemDTO item = new ItemDTO(); item.setId(itemId); item.setNamespaceId(namespaceId); item.setValue(value); item.setLineNum(1); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return item; } }
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/helm/apollo-portal/Chart.yaml
apiVersion: v2 name: apollo-portal description: A Helm chart for Apollo Portal type: application version: 0.3.0 appVersion: 1.9.0-SNAPSHOT home: https://github.com/ctripcorp/apollo icon: https://raw.githubusercontent.com/ctripcorp/apollo/master/apollo-portal/src/main/resources/static/img/logo-simple.png maintainers: - name: nobodyiam email: [email protected] url: https://github.com/nobodyiam
apiVersion: v2 name: apollo-portal description: A Helm chart for Apollo Portal type: application version: 0.3.0 appVersion: 1.9.0-SNAPSHOT home: https://github.com/ctripcorp/apollo icon: https://raw.githubusercontent.com/ctripcorp/apollo/master/apollo-portal/src/main/resources/static/img/logo-simple.png maintainers: - name: nobodyiam email: [email protected] url: https://github.com/nobodyiam
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/img/like.png
PNG  IHDRXWIDATx^_vƫc`V!/p-Vw@ް 0+<M匄õWGMjz @;`h (BSN7j%2 vWK -q4i ZiL;nH7~T]y t{{xL7MK~y>lb L|19;F4SH>0L?+l85i6~ ~4:sU+:O~4*@i6Xw̯Z/Z!Q_[OK㑺5b\hh1O}.lF1?^E;nֽhjD+\:ju˩fhnΦS22̏> 5?#Vot3?DqUҬ?1ɹD<ТV Qćc\tw6D*@&G AV*@lci.j8H:w;\Qķ@y7$&AiB @Ը󴿵!)PؠAKg?N .C z,-Giȇ ;dzh72"HZf[4 QfUAyQQG"ij1uF 𞽉4wA}"F[QS/DRxp7#ƌ_"(hDOjƎ׀ޓGOrn/O"F BI(wUkA&^r5 QUA<byQ0qcQ(baDGS%ѹ8 PD[Cq0 QͻMAbX-=CpǍn6"pUI}h5NDkt1K-]EP o%)[jms @j1z,H մFEj8KSRCTJk(bY /D0֦(b 1K{~ U_4 r=!)[  EJR.i70&(7S)<|w+Dr%~=!dFGŪQĸB"M%k=}G Z9r>j^%:+G0 _<[كo3&7%"%ӔK8;y׆5UTņm1qubC7":vU]ДY.Ravxܩ% ';f!*P6SsB{$t%$6D6+QEkIGO?7*TD(=+Weu,>LφS %27G" ƯQGt5?t<r_`Ahdl$w@2hy@#Qf[7rBG'@C+"g{S}:Rc H)B^ d ~9};h?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 @J; VR.ɩh1% `%Ȍ29j `zd Vn1Prrzrh5.A+tmorz<H:s % M{2X-Oëd 40L= `x9R2YA+76Lj@2ܩPd"m}isdi,UɩdAL(ǤF h/Z "4ڤ1iddMB.b:sW@'?#]1ОR HnoVRbޏέ"9l!:3h"gY.<oe9[/ |R&g'û*<d£oF͙,h` }t VT?0R;ɩDkz8p>P+L< R`-?u,YQ`{塦LJ@d晩޿ 73XҒE\ĸ#LN@R`}LCCaZ/SHr,pC6K hQ d!)8L:@bgn+ Y_zIEGRԞ^ 2X&!!A^k&K 3X} "9}`M "9U`3:B5fTtҐu5C5^$ 2X!KCbn&? kkҐu5;+|P ]_,3LMdKI4 k\oyO磣M_vG .Uk( p9 Q~9nMAi1MP@N)jQeuG-.ozt0:W 2kTusǭY;BLWRʛ7aTRHS]x7mh:ⰉwC[- <VXX{ )bzDGcv ;Ы% 8˴S^-QXN7j%2#5IENDB`
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/Email.java
package com.ctrip.framework.apollo.portal.entity.bo; import java.util.List; public class Email { private String senderEmailAddress; private List<String> recipients; private String subject; private String body; public String getSenderEmailAddress() { return senderEmailAddress; } public void setSenderEmailAddress(String senderEmailAddress) { this.senderEmailAddress = senderEmailAddress; } public List<String> getRecipients() { return recipients; } public String getRecipientsString() { return String.join(",", recipients); } public void setRecipients(List<String> recipients) { this.recipients = recipients; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } }
package com.ctrip.framework.apollo.portal.entity.bo; import java.util.List; public class Email { private String senderEmailAddress; private List<String> recipients; private String subject; private String body; public String getSenderEmailAddress() { return senderEmailAddress; } public void setSenderEmailAddress(String senderEmailAddress) { this.senderEmailAddress = senderEmailAddress; } public List<String> getRecipients() { return recipients; } public String getRecipientsString() { return String.join(",", recipients); } public void setRecipients(List<String> recipients) { this.recipients = recipients; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } }
-1
apolloconfig/apollo
3,609
Fixes #3606
## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
Loading-Life
2021-03-18T08:53:04Z
2021-04-01T00:12:29Z
e27d6d329bdcae9fef6679ad3854d7da9d63759f
3de1d7208bb10dc720a57458facd684e9f07f11a
Fixes #3606. ## What's the purpose of this PR 用来解决portal未启用auth并且配置了context-path后导致的, 访问首页部分资源加载404问题 ## Which issue(s) this PR fixes: Fixes #3606 ## Brief changelog 1. portal - app.html 中 lodash.min.js 引用路径修改 2. index.html 中 加入获取prefixPath逻辑 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/main/java/com/ctrip/framework/apollo/tracer/internals/cat/CatTransaction.java
package com.ctrip.framework.apollo.tracer.internals.cat; import com.ctrip.framework.apollo.tracer.spi.Transaction; import java.lang.reflect.Method; /** * @author Jason Song([email protected]) */ public class CatTransaction implements Transaction { private static Class CAT_TRANSACTION_CLASS; private static Method SET_STATUS_WITH_STRING; private static Method SET_STATUS_WITH_THROWABLE; private static Method ADD_DATA_WITH_KEY_AND_VALUE; private static Method COMPLETE; private Object catTransaction; static { try { CAT_TRANSACTION_CLASS = Class.forName(CatNames.CAT_TRANSACTION_CLASS); SET_STATUS_WITH_STRING = CAT_TRANSACTION_CLASS.getMethod(CatNames.SET_STATUS_METHOD, String.class); SET_STATUS_WITH_THROWABLE = CAT_TRANSACTION_CLASS.getMethod(CatNames.SET_STATUS_METHOD, Throwable.class); ADD_DATA_WITH_KEY_AND_VALUE = CAT_TRANSACTION_CLASS.getMethod(CatNames.ADD_DATA_METHOD, String.class, Object.class); COMPLETE = CAT_TRANSACTION_CLASS.getMethod(CatNames.COMPLETE_METHOD); } catch (Throwable ex) { throw new IllegalStateException("Initialize Cat transaction failed", ex); } } static void init() { //do nothing, just to initialize the static variables } public CatTransaction(Object catTransaction) { this.catTransaction = catTransaction; } @Override public void setStatus(String status) { try { SET_STATUS_WITH_STRING.invoke(catTransaction, status); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void setStatus(Throwable status) { try { SET_STATUS_WITH_THROWABLE.invoke(catTransaction, status); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void addData(String key, Object value) { try { ADD_DATA_WITH_KEY_AND_VALUE.invoke(catTransaction, key, value); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void complete() { try { COMPLETE.invoke(catTransaction); } catch (Throwable ex) { throw new IllegalStateException(ex); } } }
package com.ctrip.framework.apollo.tracer.internals.cat; import com.ctrip.framework.apollo.tracer.spi.Transaction; import java.lang.reflect.Method; /** * @author Jason Song([email protected]) */ public class CatTransaction implements Transaction { private static Class CAT_TRANSACTION_CLASS; private static Method SET_STATUS_WITH_STRING; private static Method SET_STATUS_WITH_THROWABLE; private static Method ADD_DATA_WITH_KEY_AND_VALUE; private static Method COMPLETE; private Object catTransaction; static { try { CAT_TRANSACTION_CLASS = Class.forName(CatNames.CAT_TRANSACTION_CLASS); SET_STATUS_WITH_STRING = CAT_TRANSACTION_CLASS.getMethod(CatNames.SET_STATUS_METHOD, String.class); SET_STATUS_WITH_THROWABLE = CAT_TRANSACTION_CLASS.getMethod(CatNames.SET_STATUS_METHOD, Throwable.class); ADD_DATA_WITH_KEY_AND_VALUE = CAT_TRANSACTION_CLASS.getMethod(CatNames.ADD_DATA_METHOD, String.class, Object.class); COMPLETE = CAT_TRANSACTION_CLASS.getMethod(CatNames.COMPLETE_METHOD); } catch (Throwable ex) { throw new IllegalStateException("Initialize Cat transaction failed", ex); } } static void init() { //do nothing, just to initialize the static variables } public CatTransaction(Object catTransaction) { this.catTransaction = catTransaction; } @Override public void setStatus(String status) { try { SET_STATUS_WITH_STRING.invoke(catTransaction, status); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void setStatus(Throwable status) { try { SET_STATUS_WITH_THROWABLE.invoke(catTransaction, status); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void addData(String key, Object value) { try { ADD_DATA_WITH_KEY_AND_VALUE.invoke(catTransaction, key, value); } catch (Throwable ex) { throw new IllegalStateException(ex); } } @Override public void complete() { try { COMPLETE.invoke(catTransaction); } catch (Throwable ex) { throw new IllegalStateException(ex); } } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java
package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.spi.ConfigRegistry; import com.ctrip.framework.apollo.spi.DefaultConfigFactory; import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager; import com.ctrip.framework.apollo.spi.DefaultConfigRegistry; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.HttpUtil; import com.ctrip.framework.apollo.util.yaml.YamlParser; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Singleton; /** * Guice injector * @author Jason Song([email protected]) */ public class DefaultInjector implements Injector { private com.google.inject.Injector m_injector; public DefaultInjector() { try { m_injector = Guice.createInjector(new ApolloModule()); } catch (Throwable ex) { ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex); Tracer.logError(exception); throw exception; } } @Override public <T> T getInstance(Class<T> clazz) { try { return m_injector.getInstance(clazz); } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s!", clazz.getName()), ex); } } @Override public <T> T getInstance(Class<T> clazz, String name) { //Guice does not support get instance by type and name return null; } private static class ApolloModule extends AbstractModule { @Override protected void configure() { bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class); bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class); bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class); bind(ConfigFactory.class).to(DefaultConfigFactory.class).in(Singleton.class); bind(ConfigUtil.class).in(Singleton.class); bind(HttpUtil.class).in(Singleton.class); bind(ConfigServiceLocator.class).in(Singleton.class); bind(RemoteConfigLongPollService.class).in(Singleton.class); bind(YamlParser.class).in(Singleton.class); bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class); } } }
package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import com.ctrip.framework.apollo.spi.ConfigFactory; import com.ctrip.framework.apollo.spi.ConfigFactoryManager; import com.ctrip.framework.apollo.spi.ConfigRegistry; import com.ctrip.framework.apollo.spi.DefaultConfigFactory; import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager; import com.ctrip.framework.apollo.spi.DefaultConfigRegistry; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.HttpUtil; import com.ctrip.framework.apollo.util.yaml.YamlParser; import com.ctrip.framework.foundation.internals.ServiceBootstrap; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Singleton; import java.util.List; /** * Guice injector * @author Jason Song([email protected]) */ public class DefaultInjector implements Injector { private final com.google.inject.Injector m_injector; private final List<ApolloInjectorCustomizer> m_customizers; public DefaultInjector() { try { m_injector = Guice.createInjector(new ApolloModule()); m_customizers = ServiceBootstrap.loadAllOrdered(ApolloInjectorCustomizer.class); } catch (Throwable ex) { ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex); Tracer.logError(exception); throw exception; } } @Override public <T> T getInstance(Class<T> clazz) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz); if (instance != null) { return instance; } } return m_injector.getInstance(clazz); } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s!", clazz.getName()), ex); } } @Override public <T> T getInstance(Class<T> clazz, String name) { try { for (ApolloInjectorCustomizer customizer : m_customizers) { T instance = customizer.getInstance(clazz, name); if (instance != null) { return instance; } } //Guice does not support get instance by type and name return null; } catch (Throwable ex) { Tracer.logError(ex); throw new ApolloConfigException( String.format("Unable to load instance for %s with name %s!", clazz.getName(), name), ex); } } private static class ApolloModule extends AbstractModule { @Override protected void configure() { bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class); bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class); bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class); bind(ConfigFactory.class).to(DefaultConfigFactory.class).in(Singleton.class); bind(ConfigUtil.class).in(Singleton.class); bind(HttpUtil.class).in(Singleton.class); bind(ConfigServiceLocator.class).in(Singleton.class); bind(RemoteConfigLongPollService.class).in(Singleton.class); bind(YamlParser.class).in(Singleton.class); bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class); } } }
1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/java/com/ctrip/framework/apollo/build/MockInjector.java
package com.ctrip.framework.apollo.build; import java.util.Map; import com.ctrip.framework.apollo.internals.DefaultInjector; import com.ctrip.framework.apollo.internals.Injector; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Maps; import com.google.common.collect.Table; /** * @author Jason Song([email protected]) */ public class MockInjector implements Injector { private static Map<Class, Object> classMap = Maps.newHashMap(); private static Table<Class, String, Object> classTable = HashBasedTable.create(); private static Injector delegate = new DefaultInjector(); @Override public <T> T getInstance(Class<T> clazz) { T o = (T) classMap.get(clazz); if (o != null) { return o; } if (delegate != null) { return delegate.getInstance(clazz); } return null; } @Override public <T> T getInstance(Class<T> clazz, String name) { T o = (T) classTable.get(clazz, name); if (o != null) { return o; } if (delegate != null) { return delegate.getInstance(clazz, name); } return null; } public static void setInstance(Class clazz, Object o) { classMap.put(clazz, o); } public static void setInstance(Class clazz, String name, Object o) { classTable.put(clazz, name, o); } public static void setDelegate(Injector delegateInjector) { delegate = delegateInjector; } public static void reset() { classMap.clear(); classTable.clear(); delegate = new DefaultInjector(); } }
package com.ctrip.framework.apollo.build; import com.ctrip.framework.apollo.internals.DefaultInjector; import com.ctrip.framework.apollo.internals.Injector; import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Maps; import com.google.common.collect.Table; import java.util.Map; /** * @author Jason Song([email protected]) */ public class MockInjector implements Injector { private static Map<Class, Object> classMap = Maps.newHashMap(); private static Table<Class, String, Object> classTable = HashBasedTable.create(); private static Injector delegate = new DefaultInjector(); @Override public <T> T getInstance(Class<T> clazz) { if (delegate != null) { return delegate.getInstance(clazz); } return null; } @Override public <T> T getInstance(Class<T> clazz, String name) { if (delegate != null) { return delegate.getInstance(clazz, name); } return null; } public static void setInstance(Class clazz, Object o) { classMap.put(clazz, o); } public static void setInstance(Class clazz, String name, Object o) { classTable.put(clazz, name, o); } public static void setDelegate(Injector delegateInjector) { delegate = delegateInjector; } public static void reset() { classMap.clear(); classTable.clear(); delegate = new DefaultInjector(); } public static class InjectCustomizer implements ApolloInjectorCustomizer { @Override public <T> T getInstance(Class<T> clazz) { return (T) classMap.get(clazz); } @Override public <T> T getInstance(Class<T> clazz, String name) { return (T) classTable.get(clazz, name); } @Override public int getOrder() { return 0; } } }
1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/main/java/com/ctrip/framework/foundation/internals/ServiceBootstrap.java
package com.ctrip.framework.foundation.internals; import com.ctrip.framework.apollo.core.spi.Ordered; import com.google.common.collect.Lists; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; public class ServiceBootstrap { public static <S> S loadFirst(Class<S> clazz) { Iterator<S> iterator = loadAll(clazz); if (!iterator.hasNext()) { throw new IllegalStateException(String.format( "No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!", clazz.getName())); } return iterator.next(); } public static <S> Iterator<S> loadAll(Class<S> clazz) { ServiceLoader<S> loader = ServiceLoader.load(clazz); return loader.iterator(); } public static <S extends Ordered> List<S> loadAllOrdered(Class<S> clazz) { Iterator<S> iterator = loadAll(clazz); if (!iterator.hasNext()) { throw new IllegalStateException(String.format( "No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!", clazz.getName())); } List<S> candidates = Lists.newArrayList(iterator); Collections.sort(candidates, new Comparator<S>() { @Override public int compare(S o1, S o2) { // the smaller order has higher priority return Integer.compare(o1.getOrder(), o2.getOrder()); } }); return candidates; } public static <S extends Ordered> S loadPrimary(Class<S> clazz) { List<S> candidates = loadAllOrdered(clazz); return candidates.get(0); } }
package com.ctrip.framework.foundation.internals; import com.ctrip.framework.apollo.core.spi.Ordered; import com.google.common.collect.Lists; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; public class ServiceBootstrap { public static <S> S loadFirst(Class<S> clazz) { Iterator<S> iterator = loadAll(clazz); if (!iterator.hasNext()) { throw new IllegalStateException(String.format( "No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!", clazz.getName())); } return iterator.next(); } public static <S> Iterator<S> loadAll(Class<S> clazz) { ServiceLoader<S> loader = ServiceLoader.load(clazz); return loader.iterator(); } public static <S extends Ordered> List<S> loadAllOrdered(Class<S> clazz) { Iterator<S> iterator = loadAll(clazz); List<S> candidates = Lists.newArrayList(iterator); Collections.sort(candidates, new Comparator<S>() { @Override public int compare(S o1, S o2) { // the smaller order has higher priority return Integer.compare(o1.getOrder(), o2.getOrder()); } }); return candidates; } public static <S extends Ordered> S loadPrimary(Class<S> clazz) { List<S> candidates = loadAllOrdered(clazz); if (candidates.isEmpty()) { throw new IllegalStateException(String.format( "No implementation defined in /META-INF/services/%s, please check whether the file exists and has the right implementation class!", clazz.getName())); } return candidates.get(0); } }
1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/test/java/com/ctrip/framework/foundation/internals/ServiceBootstrapTest.java
package com.ctrip.framework.foundation.internals; import com.ctrip.framework.apollo.core.spi.Ordered; import org.junit.Test; import java.util.ServiceConfigurationError; import static org.junit.Assert.assertTrue; /** * @author Jason Song([email protected]) */ public class ServiceBootstrapTest { @Test public void loadFirstSuccessfully() throws Exception { Interface1 service = ServiceBootstrap.loadFirst(Interface1.class); assertTrue(service instanceof Interface1Impl); } @Test(expected = IllegalStateException.class) public void loadFirstWithNoServiceFileDefined() throws Exception { ServiceBootstrap.loadFirst(Interface2.class); } @Test(expected = IllegalStateException.class) public void loadFirstWithServiceFileButNoServiceImpl() throws Exception { ServiceBootstrap.loadFirst(Interface3.class); } @Test(expected = ServiceConfigurationError.class) public void loadFirstWithWrongServiceImpl() throws Exception { ServiceBootstrap.loadFirst(Interface4.class); } @Test(expected = ServiceConfigurationError.class) public void loadFirstWithServiceImplNotExists() throws Exception { ServiceBootstrap.loadFirst(Interface5.class); } @Test public void loadPrimarySuccessfully() { Interface6 service = ServiceBootstrap.loadPrimary(Interface6.class); assertTrue(service instanceof Interface6Impl1); } @Test(expected = IllegalStateException.class) public void loadPrimaryWithServiceFileButNoServiceImpl() { ServiceBootstrap.loadPrimary(Interface7.class); } interface Interface1 { } public static class Interface1Impl implements Interface1 { } interface Interface2 { } interface Interface3 { } interface Interface4 { } interface Interface5 { } interface Interface6 extends Ordered { } public static class Interface6Impl1 implements Interface6 { @Override public int getOrder() { return 1; } } public static class Interface6Impl2 implements Interface6 { @Override public int getOrder() { return 2; } } interface Interface7 extends Ordered { } }
package com.ctrip.framework.foundation.internals; import com.ctrip.framework.apollo.core.spi.Ordered; import org.junit.Test; import java.util.ServiceConfigurationError; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * @author Jason Song([email protected]) */ public class ServiceBootstrapTest { @Test public void loadFirstSuccessfully() throws Exception { Interface1 service = ServiceBootstrap.loadFirst(Interface1.class); assertTrue(service instanceof Interface1Impl); } @Test(expected = IllegalStateException.class) public void loadFirstWithNoServiceFileDefined() throws Exception { ServiceBootstrap.loadFirst(Interface2.class); } @Test(expected = IllegalStateException.class) public void loadFirstWithServiceFileButNoServiceImpl() throws Exception { ServiceBootstrap.loadFirst(Interface3.class); } @Test(expected = ServiceConfigurationError.class) public void loadFirstWithWrongServiceImpl() throws Exception { ServiceBootstrap.loadFirst(Interface4.class); } @Test(expected = ServiceConfigurationError.class) public void loadFirstWithServiceImplNotExists() throws Exception { ServiceBootstrap.loadFirst(Interface5.class); } @Test public void loadAllWithServiceFileButNoServiceImpl() { assertFalse(ServiceBootstrap.loadAll(Interface7.class).hasNext()); } @Test public void loadPrimarySuccessfully() { Interface6 service = ServiceBootstrap.loadPrimary(Interface6.class); assertTrue(service instanceof Interface6Impl1); } @Test(expected = IllegalStateException.class) public void loadPrimaryWithServiceFileButNoServiceImpl() { ServiceBootstrap.loadPrimary(Interface7.class); } @Test public void loadAllOrderedWithServiceFileButNoServiceImpl() { assertTrue(ServiceBootstrap.loadAllOrdered(Interface7.class).isEmpty()); } interface Interface1 { } public static class Interface1Impl implements Interface1 { } interface Interface2 { } interface Interface3 { } interface Interface4 { } interface Interface5 { } interface Interface6 extends Ordered { } public static class Interface6Impl1 implements Interface6 { @Override public int getOrder() { return 1; } } public static class Interface6Impl2 implements Interface6 { @Override public int getOrder() { return 2; } } interface Interface7 extends Ordered { } }
1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishListener.java
package com.ctrip.framework.apollo.portal.listener; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import com.ctrip.framework.apollo.portal.component.ConfigReleaseWebhookNotifier; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.component.emailbuilder.GrayPublishEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.MergeEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.NormalPublishEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.RollbackEmailBuilder; import com.ctrip.framework.apollo.portal.entity.bo.Email; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.service.ReleaseHistoryService; import com.ctrip.framework.apollo.portal.spi.EmailService; import com.ctrip.framework.apollo.portal.spi.MQService; import com.ctrip.framework.apollo.tracer.Tracer; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @Component public class ConfigPublishListener { private final ReleaseHistoryService releaseHistoryService; private final EmailService emailService; private final NormalPublishEmailBuilder normalPublishEmailBuilder; private final GrayPublishEmailBuilder grayPublishEmailBuilder; private final RollbackEmailBuilder rollbackEmailBuilder; private final MergeEmailBuilder mergeEmailBuilder; private final PortalConfig portalConfig; private final MQService mqService; private final ConfigReleaseWebhookNotifier configReleaseWebhookNotifier; private ExecutorService executorService; public ConfigPublishListener( final ReleaseHistoryService releaseHistoryService, final EmailService emailService, final NormalPublishEmailBuilder normalPublishEmailBuilder, final GrayPublishEmailBuilder grayPublishEmailBuilder, final RollbackEmailBuilder rollbackEmailBuilder, final MergeEmailBuilder mergeEmailBuilder, final PortalConfig portalConfig, final MQService mqService, final ConfigReleaseWebhookNotifier configReleaseWebhookNotifier) { this.releaseHistoryService = releaseHistoryService; this.emailService = emailService; this.normalPublishEmailBuilder = normalPublishEmailBuilder; this.grayPublishEmailBuilder = grayPublishEmailBuilder; this.rollbackEmailBuilder = rollbackEmailBuilder; this.mergeEmailBuilder = mergeEmailBuilder; this.portalConfig = portalConfig; this.mqService = mqService; this.configReleaseWebhookNotifier = configReleaseWebhookNotifier; } @PostConstruct public void init() { executorService = Executors.newSingleThreadExecutor(ApolloThreadFactory.create("ConfigPublishNotify", true)); } @EventListener public void onConfigPublish(ConfigPublishEvent event) { executorService.submit(new ConfigPublishNotifyTask(event.getConfigPublishInfo())); } private class ConfigPublishNotifyTask implements Runnable { private ConfigPublishEvent.ConfigPublishInfo publishInfo; ConfigPublishNotifyTask(ConfigPublishEvent.ConfigPublishInfo publishInfo) { this.publishInfo = publishInfo; } @Override public void run() { ReleaseHistoryBO releaseHistory = getReleaseHistory(); if (releaseHistory == null) { Tracer.logError("Load release history failed", null); return; } this.sendPublishWebHook(releaseHistory); sendPublishEmail(releaseHistory); sendPublishMsg(releaseHistory); } private ReleaseHistoryBO getReleaseHistory() { Env env = publishInfo.getEnv(); int operation = publishInfo.isMergeEvent() ? ReleaseOperation.GRAY_RELEASE_MERGE_TO_MASTER : publishInfo.isRollbackEvent() ? ReleaseOperation.ROLLBACK : publishInfo.isNormalPublishEvent() ? ReleaseOperation.NORMAL_RELEASE : publishInfo.isGrayPublishEvent() ? ReleaseOperation.GRAY_RELEASE : -1; if (operation == -1) { return null; } if (publishInfo.isRollbackEvent()) { return releaseHistoryService .findLatestByPreviousReleaseIdAndOperation(env, publishInfo.getPreviousReleaseId(), operation); } return releaseHistoryService.findLatestByReleaseIdAndOperation(env, publishInfo.getReleaseId(), operation); } /** * webhook send * * @param releaseHistory */ private void sendPublishWebHook(ReleaseHistoryBO releaseHistory) { Env env = publishInfo.getEnv(); String[] webHookUrls = portalConfig.webHookUrls(); if (!portalConfig.webHookSupportedEnvs().contains(env) || webHookUrls == null) { return; } configReleaseWebhookNotifier.notify(webHookUrls, env, releaseHistory); } private void sendPublishEmail(ReleaseHistoryBO releaseHistory) { Env env = publishInfo.getEnv(); if (!portalConfig.emailSupportedEnvs().contains(env)) { return; } int realOperation = releaseHistory.getOperation(); Email email = null; try { email = buildEmail(env, releaseHistory, realOperation); } catch (Throwable e) { Tracer.logError("build email failed.", e); } if (email != null) { emailService.send(email); } } private void sendPublishMsg(ReleaseHistoryBO releaseHistory) { mqService.sendPublishMsg(publishInfo.getEnv(), releaseHistory); } private Email buildEmail(Env env, ReleaseHistoryBO releaseHistory, int operation) { switch (operation) { case ReleaseOperation.GRAY_RELEASE: { return grayPublishEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.NORMAL_RELEASE: { return normalPublishEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.ROLLBACK: { return rollbackEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.GRAY_RELEASE_MERGE_TO_MASTER: { return mergeEmailBuilder.build(env, releaseHistory); } default: return null; } } } }
package com.ctrip.framework.apollo.portal.listener; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import com.ctrip.framework.apollo.portal.component.ConfigReleaseWebhookNotifier; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.component.emailbuilder.GrayPublishEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.MergeEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.NormalPublishEmailBuilder; import com.ctrip.framework.apollo.portal.component.emailbuilder.RollbackEmailBuilder; import com.ctrip.framework.apollo.portal.entity.bo.Email; import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO; import com.ctrip.framework.apollo.portal.service.ReleaseHistoryService; import com.ctrip.framework.apollo.portal.spi.EmailService; import com.ctrip.framework.apollo.portal.spi.MQService; import com.ctrip.framework.apollo.tracer.Tracer; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @Component public class ConfigPublishListener { private final ReleaseHistoryService releaseHistoryService; private final EmailService emailService; private final NormalPublishEmailBuilder normalPublishEmailBuilder; private final GrayPublishEmailBuilder grayPublishEmailBuilder; private final RollbackEmailBuilder rollbackEmailBuilder; private final MergeEmailBuilder mergeEmailBuilder; private final PortalConfig portalConfig; private final MQService mqService; private final ConfigReleaseWebhookNotifier configReleaseWebhookNotifier; private ExecutorService executorService; public ConfigPublishListener( final ReleaseHistoryService releaseHistoryService, final EmailService emailService, final NormalPublishEmailBuilder normalPublishEmailBuilder, final GrayPublishEmailBuilder grayPublishEmailBuilder, final RollbackEmailBuilder rollbackEmailBuilder, final MergeEmailBuilder mergeEmailBuilder, final PortalConfig portalConfig, final MQService mqService, final ConfigReleaseWebhookNotifier configReleaseWebhookNotifier) { this.releaseHistoryService = releaseHistoryService; this.emailService = emailService; this.normalPublishEmailBuilder = normalPublishEmailBuilder; this.grayPublishEmailBuilder = grayPublishEmailBuilder; this.rollbackEmailBuilder = rollbackEmailBuilder; this.mergeEmailBuilder = mergeEmailBuilder; this.portalConfig = portalConfig; this.mqService = mqService; this.configReleaseWebhookNotifier = configReleaseWebhookNotifier; } @PostConstruct public void init() { executorService = Executors.newSingleThreadExecutor(ApolloThreadFactory.create("ConfigPublishNotify", true)); } @EventListener public void onConfigPublish(ConfigPublishEvent event) { executorService.submit(new ConfigPublishNotifyTask(event.getConfigPublishInfo())); } private class ConfigPublishNotifyTask implements Runnable { private ConfigPublishEvent.ConfigPublishInfo publishInfo; ConfigPublishNotifyTask(ConfigPublishEvent.ConfigPublishInfo publishInfo) { this.publishInfo = publishInfo; } @Override public void run() { ReleaseHistoryBO releaseHistory = getReleaseHistory(); if (releaseHistory == null) { Tracer.logError("Load release history failed", null); return; } this.sendPublishWebHook(releaseHistory); sendPublishEmail(releaseHistory); sendPublishMsg(releaseHistory); } private ReleaseHistoryBO getReleaseHistory() { Env env = publishInfo.getEnv(); int operation = publishInfo.isMergeEvent() ? ReleaseOperation.GRAY_RELEASE_MERGE_TO_MASTER : publishInfo.isRollbackEvent() ? ReleaseOperation.ROLLBACK : publishInfo.isNormalPublishEvent() ? ReleaseOperation.NORMAL_RELEASE : publishInfo.isGrayPublishEvent() ? ReleaseOperation.GRAY_RELEASE : -1; if (operation == -1) { return null; } if (publishInfo.isRollbackEvent()) { return releaseHistoryService .findLatestByPreviousReleaseIdAndOperation(env, publishInfo.getPreviousReleaseId(), operation); } return releaseHistoryService.findLatestByReleaseIdAndOperation(env, publishInfo.getReleaseId(), operation); } /** * webhook send * * @param releaseHistory */ private void sendPublishWebHook(ReleaseHistoryBO releaseHistory) { Env env = publishInfo.getEnv(); String[] webHookUrls = portalConfig.webHookUrls(); if (!portalConfig.webHookSupportedEnvs().contains(env) || webHookUrls == null) { return; } configReleaseWebhookNotifier.notify(webHookUrls, env, releaseHistory); } private void sendPublishEmail(ReleaseHistoryBO releaseHistory) { Env env = publishInfo.getEnv(); if (!portalConfig.emailSupportedEnvs().contains(env)) { return; } int realOperation = releaseHistory.getOperation(); Email email = null; try { email = buildEmail(env, releaseHistory, realOperation); } catch (Throwable e) { Tracer.logError("build email failed.", e); } if (email != null) { emailService.send(email); } } private void sendPublishMsg(ReleaseHistoryBO releaseHistory) { mqService.sendPublishMsg(publishInfo.getEnv(), releaseHistory); } private Email buildEmail(Env env, ReleaseHistoryBO releaseHistory, int operation) { switch (operation) { case ReleaseOperation.GRAY_RELEASE: { return grayPublishEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.NORMAL_RELEASE: { return normalPublishEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.ROLLBACK: { return rollbackEmailBuilder.build(env, releaseHistory); } case ReleaseOperation.GRAY_RELEASE_MERGE_TO_MASTER: { return mergeEmailBuilder.build(env, releaseHistory); } default: return null; } } } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/java/com/ctrip/framework/apollo/util/yaml/YamlParserTest.java
package com.ctrip.framework.apollo.util.yaml; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.util.OrderedProperties; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.google.common.base.Charsets; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.util.Properties; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; import org.springframework.core.io.ByteArrayResource; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.parser.ParserException; public class YamlParserTest { private YamlParser parser; @Before public void setUp() throws Exception { parser = new YamlParser(); } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testValidCases() throws Exception { test("case1.yaml"); test("case3.yaml"); test("case4.yaml"); test("case5.yaml"); test("case6.yaml"); test("case7.yaml"); } @Test(expected = ParserException.class) public void testcase2() throws Exception { testInvalid("case2.yaml"); } @Test(expected = ParserException.class) public void testcase8() throws Exception { testInvalid("case8.yaml"); } @Test(expected = ConstructorException.class) public void testcase9() throws Exception { testInvalid("case9.yaml"); } @Test public void testOrderProperties() throws IOException { String yamlContent = loadYaml("orderedcase.yaml"); Properties nonOrderedProperties = parser.yamlToProperties(yamlContent); PropertiesFactory propertiesFactory = mock(PropertiesFactory.class); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new OrderedProperties(); } }); MockInjector.setInstance(PropertiesFactory.class, propertiesFactory); parser = new YamlParser(); Properties orderedProperties = parser.yamlToProperties(yamlContent); assertTrue(orderedProperties instanceof OrderedProperties); checkPropertiesEquals(nonOrderedProperties, orderedProperties); String[] propertyNames = orderedProperties.stringPropertyNames().toArray(new String[0]); assertEquals("k2", propertyNames[0]); assertEquals("k4", propertyNames[1]); assertEquals("k1", propertyNames[2]); } private void test(String caseName) throws Exception { String yamlContent = loadYaml(caseName); check(yamlContent); } private String loadYaml(String caseName) throws IOException { File file = new File("src/test/resources/yaml/" + caseName); return Files.toString(file, Charsets.UTF_8); } private void testInvalid(String caseName) throws Exception { File file = new File("src/test/resources/yaml/" + caseName); String yamlContent = Files.toString(file, Charsets.UTF_8); parser.yamlToProperties(yamlContent); } private void check(String yamlContent) { YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); yamlPropertiesFactoryBean.setResources(new ByteArrayResource(yamlContent.getBytes())); Properties expected = yamlPropertiesFactoryBean.getObject(); Properties actual = parser.yamlToProperties(yamlContent); assertTrue("expected: " + expected + " actual: " + actual, checkPropertiesEquals(expected, actual)); } private boolean checkPropertiesEquals(Properties expected, Properties actual) { if (expected == actual) return true; if (expected.size() != actual.size()) return false; for (Object key : expected.keySet()) { if (!expected.getProperty((String) key).equals(actual.getProperty((String) key))) { return false; } } return true; } }
package com.ctrip.framework.apollo.util.yaml; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.util.OrderedProperties; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.google.common.base.Charsets; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.util.Properties; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; import org.springframework.core.io.ByteArrayResource; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.parser.ParserException; public class YamlParserTest { private YamlParser parser; @Before public void setUp() throws Exception { parser = new YamlParser(); } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testValidCases() throws Exception { test("case1.yaml"); test("case3.yaml"); test("case4.yaml"); test("case5.yaml"); test("case6.yaml"); test("case7.yaml"); } @Test(expected = ParserException.class) public void testcase2() throws Exception { testInvalid("case2.yaml"); } @Test(expected = ParserException.class) public void testcase8() throws Exception { testInvalid("case8.yaml"); } @Test(expected = ConstructorException.class) public void testcase9() throws Exception { testInvalid("case9.yaml"); } @Test public void testOrderProperties() throws IOException { String yamlContent = loadYaml("orderedcase.yaml"); Properties nonOrderedProperties = parser.yamlToProperties(yamlContent); PropertiesFactory propertiesFactory = mock(PropertiesFactory.class); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new OrderedProperties(); } }); MockInjector.setInstance(PropertiesFactory.class, propertiesFactory); parser = new YamlParser(); Properties orderedProperties = parser.yamlToProperties(yamlContent); assertTrue(orderedProperties instanceof OrderedProperties); checkPropertiesEquals(nonOrderedProperties, orderedProperties); String[] propertyNames = orderedProperties.stringPropertyNames().toArray(new String[0]); assertEquals("k2", propertyNames[0]); assertEquals("k4", propertyNames[1]); assertEquals("k1", propertyNames[2]); } private void test(String caseName) throws Exception { String yamlContent = loadYaml(caseName); check(yamlContent); } private String loadYaml(String caseName) throws IOException { File file = new File("src/test/resources/yaml/" + caseName); return Files.toString(file, Charsets.UTF_8); } private void testInvalid(String caseName) throws Exception { File file = new File("src/test/resources/yaml/" + caseName); String yamlContent = Files.toString(file, Charsets.UTF_8); parser.yamlToProperties(yamlContent); } private void check(String yamlContent) { YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); yamlPropertiesFactoryBean.setResources(new ByteArrayResource(yamlContent.getBytes())); Properties expected = yamlPropertiesFactoryBean.getObject(); Properties actual = parser.yamlToProperties(yamlContent); assertTrue("expected: " + expected + " actual: " + actual, checkPropertiesEquals(expected, actual)); } private boolean checkPropertiesEquals(Properties expected, Properties actual) { if (expected == actual) return true; if (expected.size() != actual.size()) return false; for (Object key : expected.keySet()) { if (!expected.getProperty((String) key).equals(actual.getProperty((String) key))) { return false; } } return true; } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithCacheTest.java
package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/oidc/OidcUserInfoHolder.java
package com.ctrip.framework.apollo.portal.spi.oidc; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import java.security.Principal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.core.oidc.StandardClaimNames; import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.security.oauth2.jwt.Jwt; /** * @author vdisk <[email protected]> */ public class OidcUserInfoHolder implements UserInfoHolder { private static final Logger log = LoggerFactory.getLogger(OidcUserInfoHolder.class); @Override public UserInfo getUser() { Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof OidcUser) { UserInfo userInfo = new UserInfo(); OidcUser oidcUser = (OidcUser) principal; userInfo.setUserId(oidcUser.getSubject()); userInfo.setName(oidcUser.getPreferredUsername()); userInfo.setEmail(oidcUser.getEmail()); return userInfo; } if (principal instanceof Jwt) { Jwt jwt = (Jwt) principal; UserInfo userInfo = new UserInfo(); userInfo.setUserId(jwt.getSubject()); return userInfo; } log.debug("principal is neither oidcUser nor jwt, principal=[{}]", principal); if (principal instanceof OAuth2User) { UserInfo userInfo = new UserInfo(); OAuth2User oAuth2User = (OAuth2User) principal; userInfo.setUserId(oAuth2User.getName()); userInfo.setName(oAuth2User.getAttribute(StandardClaimNames.PREFERRED_USERNAME)); userInfo.setEmail(oAuth2User.getAttribute(StandardClaimNames.EMAIL)); return userInfo; } if (principal instanceof Principal) { UserInfo userInfo = new UserInfo(); Principal userPrincipal = (Principal) principal; userInfo.setUserId(userPrincipal.getName()); return userInfo; } UserInfo userInfo = new UserInfo(); userInfo.setUserId(String.valueOf(principal)); return userInfo; } }
package com.ctrip.framework.apollo.portal.spi.oidc; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import java.security.Principal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.core.oidc.StandardClaimNames; import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.security.oauth2.jwt.Jwt; /** * @author vdisk <[email protected]> */ public class OidcUserInfoHolder implements UserInfoHolder { private static final Logger log = LoggerFactory.getLogger(OidcUserInfoHolder.class); @Override public UserInfo getUser() { Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof OidcUser) { UserInfo userInfo = new UserInfo(); OidcUser oidcUser = (OidcUser) principal; userInfo.setUserId(oidcUser.getSubject()); userInfo.setName(oidcUser.getPreferredUsername()); userInfo.setEmail(oidcUser.getEmail()); return userInfo; } if (principal instanceof Jwt) { Jwt jwt = (Jwt) principal; UserInfo userInfo = new UserInfo(); userInfo.setUserId(jwt.getSubject()); return userInfo; } log.debug("principal is neither oidcUser nor jwt, principal=[{}]", principal); if (principal instanceof OAuth2User) { UserInfo userInfo = new UserInfo(); OAuth2User oAuth2User = (OAuth2User) principal; userInfo.setUserId(oAuth2User.getName()); userInfo.setName(oAuth2User.getAttribute(StandardClaimNames.PREFERRED_USERNAME)); userInfo.setEmail(oAuth2User.getAttribute(StandardClaimNames.EMAIL)); return userInfo; } if (principal instanceof Principal) { UserInfo userInfo = new UserInfo(); Principal userPrincipal = (Principal) principal; userInfo.setUserId(userPrincipal.getName()); return userInfo; } UserInfo userInfo = new UserInfo(); userInfo.setUserId(String.valueOf(principal)); return userInfo; } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java
package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.portal.component.PermissionValidator; import com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel; import com.ctrip.framework.apollo.portal.service.ItemService; import com.ctrip.framework.apollo.portal.service.NamespaceService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.google.common.base.Charsets; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.constructor.DuplicateKeyException; @RunWith(MockitoJUnitRunner.class) public class ItemControllerTest { @Mock private ItemService configService; @Mock private NamespaceService namespaceService; @Mock private UserInfoHolder userInfoHolder; @Mock private PermissionValidator permissionValidator; @InjectMocks private ItemController itemController; @Before public void setUp() throws Exception { itemController = new ItemController(configService, userInfoHolder, permissionValidator, namespaceService); } @Test public void yamlSyntaxCheckOK() throws Exception { String yaml = loadYaml("case1.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } @Test(expected = DuplicateKeyException.class) public void yamlSyntaxCheckWithDuplicatedValue() throws Exception { String yaml = loadYaml("case2.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } @Test(expected = ConstructorException.class) public void yamlSyntaxCheckWithUnsupportedType() throws Exception { String yaml = loadYaml("case3.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } private NamespaceTextModel assemble(String format, String content) { NamespaceTextModel model = new NamespaceTextModel(); model.setFormat(format); model.setConfigText(content); return model; } private String loadYaml(String caseName) throws IOException { File file = new File("src/test/resources/yaml/" + caseName); return Files.toString(file, Charsets.UTF_8); } }
package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.portal.component.PermissionValidator; import com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel; import com.ctrip.framework.apollo.portal.service.ItemService; import com.ctrip.framework.apollo.portal.service.NamespaceService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.google.common.base.Charsets; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.yaml.snakeyaml.constructor.ConstructorException; import org.yaml.snakeyaml.constructor.DuplicateKeyException; @RunWith(MockitoJUnitRunner.class) public class ItemControllerTest { @Mock private ItemService configService; @Mock private NamespaceService namespaceService; @Mock private UserInfoHolder userInfoHolder; @Mock private PermissionValidator permissionValidator; @InjectMocks private ItemController itemController; @Before public void setUp() throws Exception { itemController = new ItemController(configService, userInfoHolder, permissionValidator, namespaceService); } @Test public void yamlSyntaxCheckOK() throws Exception { String yaml = loadYaml("case1.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } @Test(expected = DuplicateKeyException.class) public void yamlSyntaxCheckWithDuplicatedValue() throws Exception { String yaml = loadYaml("case2.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } @Test(expected = ConstructorException.class) public void yamlSyntaxCheckWithUnsupportedType() throws Exception { String yaml = loadYaml("case3.yaml"); itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml)); } private NamespaceTextModel assemble(String format, String content) { NamespaceTextModel model = new NamespaceTextModel(); model.setFormat(format); model.setConfigText(content); return model; } private String loadYaml(String caseName) throws IOException { File file = new File("src/test/resources/yaml/" + caseName); return Files.toString(file, Charsets.UTF_8); } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
package com.ctrip.framework.apollo.adminservice.controller; import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.service.NamespaceService; import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.exception.NotFoundException; import com.ctrip.framework.apollo.common.utils.BeanUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; import java.util.Map; @RestController public class NamespaceController { private final NamespaceService namespaceService; public NamespaceController(final NamespaceService namespaceService) { this.namespaceService = namespaceService; } @PostMapping("/apps/{appId}/clusters/{clusterName}/namespaces") public NamespaceDTO create(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @Valid @RequestBody NamespaceDTO dto) { Namespace entity = BeanUtils.transform(Namespace.class, dto); Namespace managedEntity = namespaceService.findOne(appId, clusterName, entity.getNamespaceName()); if (managedEntity != null) { throw new BadRequestException("namespace already exist."); } entity = namespaceService.save(entity); return BeanUtils.transform(NamespaceDTO.class, entity); } @DeleteMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public void delete(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @PathVariable("namespaceName") String namespaceName, @RequestParam String operator) { Namespace entity = namespaceService.findOne(appId, clusterName, namespaceName); if (entity == null) { throw new NotFoundException( String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName)); } namespaceService.deleteNamespace(entity, operator); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces") public List<NamespaceDTO> find(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName) { List<Namespace> groups = namespaceService.findNamespaces(appId, clusterName); return BeanUtils.batchTransform(NamespaceDTO.class, groups); } @GetMapping("/namespaces/{namespaceId}") public NamespaceDTO get(@PathVariable("namespaceId") Long namespaceId) { Namespace namespace = namespaceService.findOne(namespaceId); if (namespace == null) { throw new NotFoundException(String.format("namespace not found for %s", namespaceId)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public NamespaceDTO get(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @PathVariable("namespaceName") String namespaceName) { Namespace namespace = namespaceService.findOne(appId, clusterName, namespaceName); if (namespace == null) { throw new NotFoundException( String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace") public NamespaceDTO findPublicNamespaceForAssociatedNamespace(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespaceName) { Namespace namespace = namespaceService.findPublicNamespaceForAssociatedNamespace(clusterName, namespaceName); if (namespace == null) { throw new NotFoundException(String.format("public namespace not found. namespace:%s", namespaceName)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } /** * cluster -> cluster has not published namespaces? */ @GetMapping("/apps/{appId}/namespaces/publish_info") public Map<String, Boolean> namespacePublishInfo(@PathVariable String appId) { return namespaceService.namespacePublishInfo(appId); } }
package com.ctrip.framework.apollo.adminservice.controller; import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.service.NamespaceService; import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.exception.NotFoundException; import com.ctrip.framework.apollo.common.utils.BeanUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; import java.util.Map; @RestController public class NamespaceController { private final NamespaceService namespaceService; public NamespaceController(final NamespaceService namespaceService) { this.namespaceService = namespaceService; } @PostMapping("/apps/{appId}/clusters/{clusterName}/namespaces") public NamespaceDTO create(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @Valid @RequestBody NamespaceDTO dto) { Namespace entity = BeanUtils.transform(Namespace.class, dto); Namespace managedEntity = namespaceService.findOne(appId, clusterName, entity.getNamespaceName()); if (managedEntity != null) { throw new BadRequestException("namespace already exist."); } entity = namespaceService.save(entity); return BeanUtils.transform(NamespaceDTO.class, entity); } @DeleteMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public void delete(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @PathVariable("namespaceName") String namespaceName, @RequestParam String operator) { Namespace entity = namespaceService.findOne(appId, clusterName, namespaceName); if (entity == null) { throw new NotFoundException( String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName)); } namespaceService.deleteNamespace(entity, operator); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces") public List<NamespaceDTO> find(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName) { List<Namespace> groups = namespaceService.findNamespaces(appId, clusterName); return BeanUtils.batchTransform(NamespaceDTO.class, groups); } @GetMapping("/namespaces/{namespaceId}") public NamespaceDTO get(@PathVariable("namespaceId") Long namespaceId) { Namespace namespace = namespaceService.findOne(namespaceId); if (namespace == null) { throw new NotFoundException(String.format("namespace not found for %s", namespaceId)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public NamespaceDTO get(@PathVariable("appId") String appId, @PathVariable("clusterName") String clusterName, @PathVariable("namespaceName") String namespaceName) { Namespace namespace = namespaceService.findOne(appId, clusterName, namespaceName); if (namespace == null) { throw new NotFoundException( String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } @GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace") public NamespaceDTO findPublicNamespaceForAssociatedNamespace(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespaceName) { Namespace namespace = namespaceService.findPublicNamespaceForAssociatedNamespace(clusterName, namespaceName); if (namespace == null) { throw new NotFoundException(String.format("public namespace not found. namespace:%s", namespaceName)); } return BeanUtils.transform(NamespaceDTO.class, namespace); } /** * cluster -> cluster has not published namespaces? */ @GetMapping("/apps/{appId}/namespaces/publish_info") public Map<String, Boolean> namespacePublishInfo(@PathVariable String appId) { return namespaceService.namespacePublishInfo(appId); } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/ReleaseMessageServiceWithCacheTest.java
package com.ctrip.framework.apollo.configservice.service; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import static org.awaitility.Awaitility.await; import static org.junit.Assert.*; import static org.mockito.Mockito.*; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ReleaseMessageServiceWithCacheTest { private ReleaseMessageServiceWithCache releaseMessageServiceWithCache; @Mock private ReleaseMessageRepository releaseMessageRepository; @Mock private BizConfig bizConfig; private int scanInterval; private TimeUnit scanIntervalTimeUnit; @Before public void setUp() throws Exception { releaseMessageServiceWithCache = new ReleaseMessageServiceWithCache( releaseMessageRepository, bizConfig ); scanInterval = 10; scanIntervalTimeUnit = TimeUnit.MILLISECONDS; when(bizConfig.releaseMessageCacheScanInterval()).thenReturn(scanInterval); when(bizConfig.releaseMessageCacheScanIntervalTimeUnit()).thenReturn(scanIntervalTimeUnit); } @Test public void testWhenNoReleaseMessages() throws Exception { when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn (Collections.emptyList()); releaseMessageServiceWithCache.afterPropertiesSet(); String someMessage = "someMessage"; String anotherMessage = "anotherMessage"; Set<String> messages = Sets.newHashSet(someMessage, anotherMessage); assertNull(releaseMessageServiceWithCache.findLatestReleaseMessageForMessages(messages)); assertTrue(releaseMessageServiceWithCache.findLatestReleaseMessagesGroupByMessages(messages) .isEmpty()); } @Test public void testWhenHasReleaseMsgAndHasRepeatMsg() throws Exception { String someMsgContent = "msg1"; ReleaseMessage someMsg = assembleReleaseMsg(1, someMsgContent); String anotherMsgContent = "msg2"; ReleaseMessage anotherMsg = assembleReleaseMsg(2, anotherMsgContent); ReleaseMessage anotherRepeatMsg = assembleReleaseMsg(3, anotherMsgContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)) .thenReturn(Arrays.asList(someMsg, anotherMsg, anotherRepeatMsg)); releaseMessageServiceWithCache.afterPropertiesSet(); verify(bizConfig).releaseMessageCacheScanInterval(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMsgContent, anotherMsgContent)); assertNotNull(latestReleaseMsg); assertEquals(3, latestReleaseMsg.getId()); assertEquals(anotherMsgContent, latestReleaseMsg.getMessage()); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newLinkedHashSet( Arrays.asList(someMsgContent, anotherMsgContent)) ); assertEquals(2, latestReleaseMsgGroupByMsgContent.size()); assertEquals(3, latestReleaseMsgGroupByMsgContent.get(1).getId()); assertEquals(anotherMsgContent, latestReleaseMsgGroupByMsgContent.get(1).getMessage()); assertEquals(1, latestReleaseMsgGroupByMsgContent.get(0).getId()); assertEquals(someMsgContent, latestReleaseMsgGroupByMsgContent.get(0).getMessage()); } @Test public void testWhenReleaseMsgSizeBiggerThan500() throws Exception { String someMsgContent = "msg1"; List<ReleaseMessage> firstBatchReleaseMsg = new ArrayList<>(500); for (int i = 0; i < 500; i++) { firstBatchReleaseMsg.add(assembleReleaseMsg(i + 1, someMsgContent)); } String antherMsgContent = "msg2"; ReleaseMessage antherMsg = assembleReleaseMsg(501, antherMsgContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)) .thenReturn(firstBatchReleaseMsg); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(500L)) .thenReturn(Collections.singletonList(antherMsg)); releaseMessageServiceWithCache.afterPropertiesSet(); verify(releaseMessageRepository, times(1)).findFirst500ByIdGreaterThanOrderByIdAsc(500L); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMsgContent, antherMsgContent)); assertNotNull(latestReleaseMsg); assertEquals(501, latestReleaseMsg.getId()); assertEquals(antherMsgContent, latestReleaseMsg.getMessage()); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMsgContent, antherMsgContent)); assertEquals(2, latestReleaseMsgGroupByMsgContent.size()); assertEquals(500, latestReleaseMsgGroupByMsgContent.get(1).getId()); assertEquals(501, latestReleaseMsgGroupByMsgContent.get(0).getId()); } @Test public void testNewReleaseMessagesBeforeHandleMessage() throws Exception { String someMessageContent = "someMessage"; long someMessageId = 1; ReleaseMessage someMessage = assembleReleaseMsg(someMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists.newArrayList (someMessage)); releaseMessageServiceWithCache.afterPropertiesSet(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(someMessageId, latestReleaseMsg.getId()); assertEquals(someMessageContent, latestReleaseMsg.getMessage()); assertEquals(latestReleaseMsg, latestReleaseMsgGroupByMsgContent.get(0)); long newMessageId = 2; ReleaseMessage newMessage = assembleReleaseMsg(newMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(someMessageId)).thenReturn(Lists .newArrayList(newMessage)); await().atMost(scanInterval * 500, scanIntervalTimeUnit).untilAsserted(() -> { ReleaseMessage newLatestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> newLatestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(newMessageId, newLatestReleaseMsg.getId()); assertEquals(someMessageContent, newLatestReleaseMsg.getMessage()); assertEquals(newLatestReleaseMsg, newLatestReleaseMsgGroupByMsgContent.get(0)); }); } @Test public void testNewReleasesWithHandleMessage() throws Exception { String someMessageContent = "someMessage"; long someMessageId = 1; ReleaseMessage someMessage = assembleReleaseMsg(someMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists.newArrayList (someMessage)); releaseMessageServiceWithCache.afterPropertiesSet(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(someMessageId, latestReleaseMsg.getId()); assertEquals(someMessageContent, latestReleaseMsg.getMessage()); assertEquals(latestReleaseMsg, latestReleaseMsgGroupByMsgContent.get(0)); long newMessageId = 2; ReleaseMessage newMessage = assembleReleaseMsg(newMessageId, someMessageContent); releaseMessageServiceWithCache.handleMessage(newMessage, Topics.APOLLO_RELEASE_TOPIC); ReleaseMessage newLatestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> newLatestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(newMessageId, newLatestReleaseMsg.getId()); assertEquals(someMessageContent, newLatestReleaseMsg.getMessage()); assertEquals(newLatestReleaseMsg, newLatestReleaseMsgGroupByMsgContent.get(0)); } private ReleaseMessage assembleReleaseMsg(long id, String msgContent) { ReleaseMessage msg = new ReleaseMessage(msgContent); msg.setId(id); return msg; } }
package com.ctrip.framework.apollo.configservice.service; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import static org.awaitility.Awaitility.await; import static org.junit.Assert.*; import static org.mockito.Mockito.*; /** * @author Jason Song([email protected]) */ @RunWith(MockitoJUnitRunner.class) public class ReleaseMessageServiceWithCacheTest { private ReleaseMessageServiceWithCache releaseMessageServiceWithCache; @Mock private ReleaseMessageRepository releaseMessageRepository; @Mock private BizConfig bizConfig; private int scanInterval; private TimeUnit scanIntervalTimeUnit; @Before public void setUp() throws Exception { releaseMessageServiceWithCache = new ReleaseMessageServiceWithCache( releaseMessageRepository, bizConfig ); scanInterval = 10; scanIntervalTimeUnit = TimeUnit.MILLISECONDS; when(bizConfig.releaseMessageCacheScanInterval()).thenReturn(scanInterval); when(bizConfig.releaseMessageCacheScanIntervalTimeUnit()).thenReturn(scanIntervalTimeUnit); } @Test public void testWhenNoReleaseMessages() throws Exception { when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn (Collections.emptyList()); releaseMessageServiceWithCache.afterPropertiesSet(); String someMessage = "someMessage"; String anotherMessage = "anotherMessage"; Set<String> messages = Sets.newHashSet(someMessage, anotherMessage); assertNull(releaseMessageServiceWithCache.findLatestReleaseMessageForMessages(messages)); assertTrue(releaseMessageServiceWithCache.findLatestReleaseMessagesGroupByMessages(messages) .isEmpty()); } @Test public void testWhenHasReleaseMsgAndHasRepeatMsg() throws Exception { String someMsgContent = "msg1"; ReleaseMessage someMsg = assembleReleaseMsg(1, someMsgContent); String anotherMsgContent = "msg2"; ReleaseMessage anotherMsg = assembleReleaseMsg(2, anotherMsgContent); ReleaseMessage anotherRepeatMsg = assembleReleaseMsg(3, anotherMsgContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)) .thenReturn(Arrays.asList(someMsg, anotherMsg, anotherRepeatMsg)); releaseMessageServiceWithCache.afterPropertiesSet(); verify(bizConfig).releaseMessageCacheScanInterval(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMsgContent, anotherMsgContent)); assertNotNull(latestReleaseMsg); assertEquals(3, latestReleaseMsg.getId()); assertEquals(anotherMsgContent, latestReleaseMsg.getMessage()); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newLinkedHashSet( Arrays.asList(someMsgContent, anotherMsgContent)) ); assertEquals(2, latestReleaseMsgGroupByMsgContent.size()); assertEquals(3, latestReleaseMsgGroupByMsgContent.get(1).getId()); assertEquals(anotherMsgContent, latestReleaseMsgGroupByMsgContent.get(1).getMessage()); assertEquals(1, latestReleaseMsgGroupByMsgContent.get(0).getId()); assertEquals(someMsgContent, latestReleaseMsgGroupByMsgContent.get(0).getMessage()); } @Test public void testWhenReleaseMsgSizeBiggerThan500() throws Exception { String someMsgContent = "msg1"; List<ReleaseMessage> firstBatchReleaseMsg = new ArrayList<>(500); for (int i = 0; i < 500; i++) { firstBatchReleaseMsg.add(assembleReleaseMsg(i + 1, someMsgContent)); } String antherMsgContent = "msg2"; ReleaseMessage antherMsg = assembleReleaseMsg(501, antherMsgContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)) .thenReturn(firstBatchReleaseMsg); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(500L)) .thenReturn(Collections.singletonList(antherMsg)); releaseMessageServiceWithCache.afterPropertiesSet(); verify(releaseMessageRepository, times(1)).findFirst500ByIdGreaterThanOrderByIdAsc(500L); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMsgContent, antherMsgContent)); assertNotNull(latestReleaseMsg); assertEquals(501, latestReleaseMsg.getId()); assertEquals(antherMsgContent, latestReleaseMsg.getMessage()); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMsgContent, antherMsgContent)); assertEquals(2, latestReleaseMsgGroupByMsgContent.size()); assertEquals(500, latestReleaseMsgGroupByMsgContent.get(1).getId()); assertEquals(501, latestReleaseMsgGroupByMsgContent.get(0).getId()); } @Test public void testNewReleaseMessagesBeforeHandleMessage() throws Exception { String someMessageContent = "someMessage"; long someMessageId = 1; ReleaseMessage someMessage = assembleReleaseMsg(someMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists.newArrayList (someMessage)); releaseMessageServiceWithCache.afterPropertiesSet(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(someMessageId, latestReleaseMsg.getId()); assertEquals(someMessageContent, latestReleaseMsg.getMessage()); assertEquals(latestReleaseMsg, latestReleaseMsgGroupByMsgContent.get(0)); long newMessageId = 2; ReleaseMessage newMessage = assembleReleaseMsg(newMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(someMessageId)).thenReturn(Lists .newArrayList(newMessage)); await().atMost(scanInterval * 500, scanIntervalTimeUnit).untilAsserted(() -> { ReleaseMessage newLatestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> newLatestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(newMessageId, newLatestReleaseMsg.getId()); assertEquals(someMessageContent, newLatestReleaseMsg.getMessage()); assertEquals(newLatestReleaseMsg, newLatestReleaseMsgGroupByMsgContent.get(0)); }); } @Test public void testNewReleasesWithHandleMessage() throws Exception { String someMessageContent = "someMessage"; long someMessageId = 1; ReleaseMessage someMessage = assembleReleaseMsg(someMessageId, someMessageContent); when(releaseMessageRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists.newArrayList (someMessage)); releaseMessageServiceWithCache.afterPropertiesSet(); ReleaseMessage latestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> latestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(someMessageId, latestReleaseMsg.getId()); assertEquals(someMessageContent, latestReleaseMsg.getMessage()); assertEquals(latestReleaseMsg, latestReleaseMsgGroupByMsgContent.get(0)); long newMessageId = 2; ReleaseMessage newMessage = assembleReleaseMsg(newMessageId, someMessageContent); releaseMessageServiceWithCache.handleMessage(newMessage, Topics.APOLLO_RELEASE_TOPIC); ReleaseMessage newLatestReleaseMsg = releaseMessageServiceWithCache .findLatestReleaseMessageForMessages(Sets.newHashSet(someMessageContent)); List<ReleaseMessage> newLatestReleaseMsgGroupByMsgContent = releaseMessageServiceWithCache .findLatestReleaseMessagesGroupByMessages(Sets.newHashSet(someMessageContent)); assertEquals(newMessageId, newLatestReleaseMsg.getId()); assertEquals(someMessageContent, newLatestReleaseMsg.getMessage()); assertEquals(newLatestReleaseMsg, newLatestReleaseMsgGroupByMsgContent.get(0)); } private ReleaseMessage assembleReleaseMsg(long id, String msgContent) { ReleaseMessage msg = new ReleaseMessage(msgContent); msg.setId(id); return msg; } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/environment/PortalMetaDomainServiceTest.java
package com.ctrip.framework.apollo.portal.environment; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PortalMetaDomainServiceTest extends BaseIntegrationTest { private PortalMetaDomainService portalMetaDomainService; @Mock private PortalConfig portalConfig; @Before public void init() { final Map<String, String> map = new HashMap<>(); map.put("nothing", "http://unknown.com"); Mockito.when(portalConfig.getMetaServers()).thenReturn(map); portalMetaDomainService = new PortalMetaDomainService(portalConfig); } @Test public void testGetMetaDomain() { // local String localMetaServerAddress = "http://localhost:8080"; mockMetaServerAddress(Env.LOCAL, localMetaServerAddress); assertEquals(localMetaServerAddress, portalMetaDomainService.getDomain(Env.LOCAL)); // add this environment without meta server address String randomEnvironment = "randomEnvironment"; Env.addEnvironment(randomEnvironment); assertEquals(PortalMetaDomainService.DEFAULT_META_URL, portalMetaDomainService.getDomain(Env.valueOf(randomEnvironment))); } @Test public void testGetValidAddress() throws Exception { String someResponse = "some response"; startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_OK, someResponse)); String validServer = " http://localhost:" + PORT + " "; String invalidServer = "http://localhost:" + findFreePort(); mockMetaServerAddress(Env.FAT, validServer + "," + invalidServer); mockMetaServerAddress(Env.UAT, invalidServer + "," + validServer); portalMetaDomainService.reload(); assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.FAT)); assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.UAT)); } @Test public void testInvalidAddress() { String invalidServer = "http://localhost:" + findFreePort() + " "; String anotherInvalidServer = "http://localhost:" + findFreePort() + " "; mockMetaServerAddress(Env.LPT, invalidServer + "," + anotherInvalidServer); portalMetaDomainService.reload(); String metaServer = portalMetaDomainService.getDomain(Env.LPT); assertTrue(metaServer.equals(invalidServer.trim()) || metaServer.equals(anotherInvalidServer.trim())); } private void mockMetaServerAddress(Env env, String metaServerAddress) { // add it to system's property System.setProperty(env.getName() + "_meta", metaServerAddress); } }
package com.ctrip.framework.apollo.portal.environment; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class PortalMetaDomainServiceTest extends BaseIntegrationTest { private PortalMetaDomainService portalMetaDomainService; @Mock private PortalConfig portalConfig; @Before public void init() { final Map<String, String> map = new HashMap<>(); map.put("nothing", "http://unknown.com"); Mockito.when(portalConfig.getMetaServers()).thenReturn(map); portalMetaDomainService = new PortalMetaDomainService(portalConfig); } @Test public void testGetMetaDomain() { // local String localMetaServerAddress = "http://localhost:8080"; mockMetaServerAddress(Env.LOCAL, localMetaServerAddress); assertEquals(localMetaServerAddress, portalMetaDomainService.getDomain(Env.LOCAL)); // add this environment without meta server address String randomEnvironment = "randomEnvironment"; Env.addEnvironment(randomEnvironment); assertEquals(PortalMetaDomainService.DEFAULT_META_URL, portalMetaDomainService.getDomain(Env.valueOf(randomEnvironment))); } @Test public void testGetValidAddress() throws Exception { String someResponse = "some response"; startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_OK, someResponse)); String validServer = " http://localhost:" + PORT + " "; String invalidServer = "http://localhost:" + findFreePort(); mockMetaServerAddress(Env.FAT, validServer + "," + invalidServer); mockMetaServerAddress(Env.UAT, invalidServer + "," + validServer); portalMetaDomainService.reload(); assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.FAT)); assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.UAT)); } @Test public void testInvalidAddress() { String invalidServer = "http://localhost:" + findFreePort() + " "; String anotherInvalidServer = "http://localhost:" + findFreePort() + " "; mockMetaServerAddress(Env.LPT, invalidServer + "," + anotherInvalidServer); portalMetaDomainService.reload(); String metaServer = portalMetaDomainService.getDomain(Env.LPT); assertTrue(metaServer.equals(invalidServer.trim()) || metaServer.equals(anotherInvalidServer.trim())); } private void mockMetaServerAddress(Env env, String metaServerAddress) { // add it to system's property System.setProperty(env.getName() + "_meta", metaServerAddress); } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java
package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; /** * @author Jason Song([email protected]) */ @Entity @Table(name = "Cluster") @SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Cluster extends BaseEntity implements Comparable<Cluster> { @Column(name = "Name", nullable = false) private String name; @Column(name = "AppId", nullable = false) private String appId; @Column(name = "ParentClusterId", nullable = false) private long parentClusterId; public String getAppId() { return appId; } public String getName() { return name; } public void setAppId(String appId) { this.appId = appId; } public void setName(String name) { this.name = name; } public long getParentClusterId() { return parentClusterId; } public void setParentClusterId(long parentClusterId) { this.parentClusterId = parentClusterId; } public String toString() { return toStringHelper().add("name", name).add("appId", appId) .add("parentClusterId", parentClusterId).toString(); } @Override public int compareTo(Cluster o) { if (o == null || getId() > o.getId()) { return 1; } if (getId() == o.getId()) { return 0; } return -1; } }
package com.ctrip.framework.apollo.biz.entity; import com.ctrip.framework.apollo.common.entity.BaseEntity; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; /** * @author Jason Song([email protected]) */ @Entity @Table(name = "Cluster") @SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?") @Where(clause = "isDeleted = 0") public class Cluster extends BaseEntity implements Comparable<Cluster> { @Column(name = "Name", nullable = false) private String name; @Column(name = "AppId", nullable = false) private String appId; @Column(name = "ParentClusterId", nullable = false) private long parentClusterId; public String getAppId() { return appId; } public String getName() { return name; } public void setAppId(String appId) { this.appId = appId; } public void setName(String name) { this.name = name; } public long getParentClusterId() { return parentClusterId; } public void setParentClusterId(long parentClusterId) { this.parentClusterId = parentClusterId; } public String toString() { return toStringHelper().add("name", name).add("appId", appId) .add("parentClusterId", parentClusterId).toString(); } @Override public int compareTo(Cluster o) { if (o == null || getId() > o.getId()) { return 1; } if (getId() == o.getId()) { return 0; } return -1; } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/test/java/com/ctrip/framework/apollo/core/enums/EnvUtilsTest.java
package com.ctrip.framework.apollo.core.enums; import static org.junit.Assert.*; import org.junit.Test; public class EnvUtilsTest { @Test public void testTransformEnv() throws Exception { assertEquals(Env.DEV, EnvUtils.transformEnv(Env.DEV.name())); assertEquals(Env.FAT, EnvUtils.transformEnv(Env.FAT.name().toLowerCase())); assertEquals(Env.UAT, EnvUtils.transformEnv(" " + Env.UAT.name().toUpperCase() + "")); assertEquals(Env.UNKNOWN, EnvUtils.transformEnv("someInvalidEnv")); } @Test public void testFromString() throws Exception { assertEquals(Env.DEV, Env.fromString(Env.DEV.name())); assertEquals(Env.FAT, Env.fromString(Env.FAT.name().toLowerCase())); assertEquals(Env.UAT, Env.fromString(" " + Env.UAT.name().toUpperCase() + "")); } @Test(expected = IllegalArgumentException.class) public void testFromInvalidString() throws Exception { Env.fromString("someInvalidEnv"); } }
package com.ctrip.framework.apollo.core.enums; import static org.junit.Assert.*; import org.junit.Test; public class EnvUtilsTest { @Test public void testTransformEnv() throws Exception { assertEquals(Env.DEV, EnvUtils.transformEnv(Env.DEV.name())); assertEquals(Env.FAT, EnvUtils.transformEnv(Env.FAT.name().toLowerCase())); assertEquals(Env.UAT, EnvUtils.transformEnv(" " + Env.UAT.name().toUpperCase() + "")); assertEquals(Env.UNKNOWN, EnvUtils.transformEnv("someInvalidEnv")); } @Test public void testFromString() throws Exception { assertEquals(Env.DEV, Env.fromString(Env.DEV.name())); assertEquals(Env.FAT, Env.fromString(Env.FAT.name().toLowerCase())); assertEquals(Env.UAT, Env.fromString(" " + Env.UAT.name().toUpperCase() + "")); } @Test(expected = IllegalArgumentException.class) public void testFromInvalidString() throws Exception { Env.fromString("someInvalidEnv"); } }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/BizTestConfiguration.java
package com.ctrip.framework.apollo.biz; import com.ctrip.framework.apollo.common.ApolloCommonConfig; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, ApolloBizConfig.class}) public class BizTestConfiguration { }
package com.ctrip.framework.apollo.biz; import com.ctrip.framework.apollo.common.ApolloCommonConfig; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, ApolloBizConfig.class}) public class BizTestConfiguration { }
-1
apolloconfig/apollo
3,602
Allow users to inject customized instance via ApolloInjectorCustomizer
## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-03-13T11:14:58Z
2021-03-13T11:19:34Z
d05979590d99ae142445c104003d7c5a05804e32
1f5b3648fb6fbb1fa9833b04fe9d7ed32eee9932
Allow users to inject customized instance via ApolloInjectorCustomizer. ## What's the purpose of this PR Allow users to inject customized instances via ApolloInjectorCustomizer ## Which issue(s) this PR fixes: Fixes #3573 ## Brief changelog 1. Add ApolloInjectorCustomizer 2. Load customized instances in DefaultInjector Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/java/com/ctrip/framework/apollo/internals/RemoteConfigRepositoryTest.java
package com.ctrip.framework.apollo.internals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.any; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.ctrip.framework.apollo.core.signature.Signature; import com.ctrip.framework.apollo.enums.ConfigSourceType; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.OrderedProperties; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.HttpRequest; import com.ctrip.framework.apollo.util.http.HttpResponse; import com.ctrip.framework.apollo.util.http.HttpUtil; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.net.HttpHeaders; import com.google.common.net.UrlEscapers; import com.google.common.util.concurrent.SettableFuture; import com.google.gson.Gson; import java.lang.reflect.Type; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletResponse; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; /** * Created by Jason on 4/9/16. */ @RunWith(MockitoJUnitRunner.class) public class RemoteConfigRepositoryTest { @Mock private ConfigServiceLocator configServiceLocator; private String someNamespace; private String someServerUrl; private ConfigUtil configUtil; private HttpUtil httpUtil; @Mock private static HttpResponse<ApolloConfig> someResponse; @Mock private static HttpResponse<List<ApolloConfigNotification>> pollResponse; private RemoteConfigLongPollService remoteConfigLongPollService; @Mock private PropertiesFactory propertiesFactory; private static String someAppId; private static String someCluster; private static String someSecret; @Before public void setUp() throws Exception { someNamespace = "someName"; when(pollResponse.getStatusCode()).thenReturn(HttpServletResponse.SC_NOT_MODIFIED); configUtil = new MockConfigUtil(); MockInjector.setInstance(ConfigUtil.class, configUtil); someServerUrl = "http://someServer"; ServiceDTO serviceDTO = mock(ServiceDTO.class); when(serviceDTO.getHomepageUrl()).thenReturn(someServerUrl); when(configServiceLocator.getConfigServices()).thenReturn(Lists.newArrayList(serviceDTO)); MockInjector.setInstance(ConfigServiceLocator.class, configServiceLocator); httpUtil = spy(new MockHttpUtil()); MockInjector.setInstance(HttpUtil.class, httpUtil); remoteConfigLongPollService = new RemoteConfigLongPollService(); MockInjector.setInstance(RemoteConfigLongPollService.class, remoteConfigLongPollService); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new Properties(); } }); MockInjector.setInstance(PropertiesFactory.class, propertiesFactory); someAppId = "someAppId"; someCluster = "someCluster"; } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testLoadConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test public void testLoadConfigWithOrderedProperties() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newLinkedHashMap(); configurations.put(someKey, someValue); configurations.put("someKey2", "someValue2"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new OrderedProperties(); } }); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertTrue(config instanceof OrderedProperties); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); String[] actualArrays = config.keySet().toArray(new String[]{}); String[] expectedArrays = {"someKey", "someKey2"}; assertArrayEquals(expectedArrays, actualArrays); } @Test public void testLoadConfigWithAccessKeySecret() throws Exception { someSecret = "someSecret"; String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); doAnswer(new Answer<HttpResponse<ApolloConfig>>() { @Override public HttpResponse<ApolloConfig> answer(InvocationOnMock invocation) throws Throwable { HttpRequest request = invocation.getArgumentAt(0, HttpRequest.class); Map<String, String> headers = request.getHeaders(); assertNotNull(headers); assertTrue(headers.containsKey(Signature.HTTP_HEADER_TIMESTAMP)); assertTrue(headers.containsKey(HttpHeaders.AUTHORIZATION)); return someResponse; } }).when(httpUtil).doGet(any(HttpRequest.class), any(Class.class)); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test(expected = ApolloConfigException.class) public void testGetRemoteConfigWithServerError() throws Exception { when(someResponse.getStatusCode()).thenReturn(500); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); //must stop the long polling before exception occurred remoteConfigLongPollService.stopLongPollingRefresh(); remoteConfigRepository.getConfig(); } @Test(expected = ApolloConfigException.class) public void testGetRemoteConfigWithNotFount() throws Exception { when(someResponse.getStatusCode()).thenReturn(404); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); //must stop the long polling before exception occurred remoteConfigLongPollService.stopLongPollingRefresh(); remoteConfigRepository.getConfig(); } @Test public void testRepositoryChangeListener() throws Exception { Map<String, String> configurations = ImmutableMap.of("someKey", "someValue"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); RepositoryChangeListener someListener = mock(RepositoryChangeListener.class); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); remoteConfigRepository.addChangeListener(someListener); final ArgumentCaptor<Properties> captor = ArgumentCaptor.forClass(Properties.class); Map<String, String> newConfigurations = ImmutableMap.of("someKey", "anotherValue"); ApolloConfig newApolloConfig = assembleApolloConfig(newConfigurations); when(someResponse.getBody()).thenReturn(newApolloConfig); remoteConfigRepository.sync(); verify(someListener, times(1)).onRepositoryChange(eq(someNamespace), captor.capture()); assertEquals(newConfigurations, captor.getValue()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test public void testLongPollingRefresh() throws Exception { Map<String, String> configurations = ImmutableMap.of("someKey", "someValue"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); RepositoryChangeListener someListener = mock(RepositoryChangeListener.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { longPollFinished.set(true); return null; } }).when(someListener).onRepositoryChange(any(String.class), any(Properties.class)); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); remoteConfigRepository.addChangeListener(someListener); final ArgumentCaptor<Properties> captor = ArgumentCaptor.forClass(Properties.class); Map<String, String> newConfigurations = ImmutableMap.of("someKey", "anotherValue"); ApolloConfig newApolloConfig = assembleApolloConfig(newConfigurations); ApolloNotificationMessages notificationMessages = new ApolloNotificationMessages(); String someKey = "someKey"; long someNotificationId = 1; notificationMessages.put(someKey, someNotificationId); ApolloConfigNotification someNotification = mock(ApolloConfigNotification.class); when(someNotification.getNamespaceName()).thenReturn(someNamespace); when(someNotification.getMessages()).thenReturn(notificationMessages); when(pollResponse.getStatusCode()).thenReturn(HttpServletResponse.SC_OK); when(pollResponse.getBody()).thenReturn(Lists.newArrayList(someNotification)); when(someResponse.getBody()).thenReturn(newApolloConfig); longPollFinished.get(5000, TimeUnit.MILLISECONDS); remoteConfigLongPollService.stopLongPollingRefresh(); verify(someListener, times(1)).onRepositoryChange(eq(someNamespace), captor.capture()); assertEquals(newConfigurations, captor.getValue()); final ArgumentCaptor<HttpRequest> httpRequestArgumentCaptor = ArgumentCaptor .forClass(HttpRequest.class); verify(httpUtil, atLeast(2)).doGet(httpRequestArgumentCaptor.capture(), eq(ApolloConfig.class)); HttpRequest request = httpRequestArgumentCaptor.getValue(); assertTrue(request.getUrl().contains("messages=%7B%22details%22%3A%7B%22someKey%22%3A1%7D%7D")); } @Test public void testAssembleQueryConfigUrl() throws Exception { Gson gson = new Gson(); String someUri = "http://someServer"; String someAppId = "someAppId"; String someCluster = "someCluster+ &.-_someSign"; String someReleaseKey = "20160705193346-583078ef5716c055+20160705193308-31c471ddf9087c3f"; ApolloNotificationMessages notificationMessages = new ApolloNotificationMessages(); String someKey = "someKey"; long someNotificationId = 1; String anotherKey = "anotherKey"; long anotherNotificationId = 2; notificationMessages.put(someKey, someNotificationId); notificationMessages.put(anotherKey, anotherNotificationId); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getReleaseKey()).thenReturn(someReleaseKey); String queryConfigUrl = remoteConfigRepository .assembleQueryConfigUrl(someUri, someAppId, someCluster, someNamespace, null, notificationMessages, someApolloConfig); remoteConfigLongPollService.stopLongPollingRefresh(); assertTrue(queryConfigUrl .contains( "http://someServer/configs/someAppId/someCluster+%20&.-_someSign/" + someNamespace)); assertTrue(queryConfigUrl .contains("releaseKey=20160705193346-583078ef5716c055%2B20160705193308-31c471ddf9087c3f")); assertTrue(queryConfigUrl .contains("messages=" + UrlEscapers.urlFormParameterEscaper() .escape(gson.toJson(notificationMessages)))); } private ApolloConfig assembleApolloConfig(Map<String, String> configurations) { String someAppId = "appId"; String someClusterName = "cluster"; String someReleaseKey = "1"; ApolloConfig apolloConfig = new ApolloConfig(someAppId, someClusterName, someNamespace, someReleaseKey); apolloConfig.setConfigurations(configurations); return apolloConfig; } public static class MockConfigUtil extends ConfigUtil { @Override public String getAppId() { return someAppId; } @Override public String getCluster() { return someCluster; } @Override public String getAccessKeySecret() { return someSecret; } @Override public String getDataCenter() { return null; } @Override public int getLoadConfigQPS() { return 200; } @Override public int getLongPollQPS() { return 200; } @Override public long getOnErrorRetryInterval() { return 10; } @Override public TimeUnit getOnErrorRetryIntervalTimeUnit() { return TimeUnit.MILLISECONDS; } @Override public long getLongPollingInitialDelayInMills() { return 0; } } public static class MockHttpUtil extends HttpUtil { @Override public <T> HttpResponse<T> doGet(HttpRequest httpRequest, Class<T> responseType) { if (someResponse.getStatusCode() == 200 || someResponse.getStatusCode() == 304) { return (HttpResponse<T>) someResponse; } throw new ApolloConfigStatusCodeException(someResponse.getStatusCode(), String.format("Http request failed due to status code: %d", someResponse.getStatusCode())); } @Override public <T> HttpResponse<T> doGet(HttpRequest httpRequest, Type responseType) { try { TimeUnit.MILLISECONDS.sleep(50); } catch (InterruptedException e) { } return (HttpResponse<T>) pollResponse; } } }
package com.ctrip.framework.apollo.internals; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.any; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.ctrip.framework.apollo.core.signature.Signature; import com.ctrip.framework.apollo.enums.ConfigSourceType; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.OrderedProperties; import com.ctrip.framework.apollo.util.factory.PropertiesFactory; import com.ctrip.framework.apollo.util.http.HttpRequest; import com.ctrip.framework.apollo.util.http.HttpResponse; import com.ctrip.framework.apollo.util.http.HttpUtil; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.net.HttpHeaders; import com.google.common.net.UrlEscapers; import com.google.common.util.concurrent.SettableFuture; import com.google.gson.Gson; import java.lang.reflect.Type; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletResponse; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; /** * Created by Jason on 4/9/16. */ @RunWith(MockitoJUnitRunner.class) public class RemoteConfigRepositoryTest { @Mock private ConfigServiceLocator configServiceLocator; private String someNamespace; private String someServerUrl; private ConfigUtil configUtil; private HttpUtil httpUtil; @Mock private static HttpResponse<ApolloConfig> someResponse; @Mock private static HttpResponse<List<ApolloConfigNotification>> pollResponse; private RemoteConfigLongPollService remoteConfigLongPollService; @Mock private PropertiesFactory propertiesFactory; private static String someAppId; private static String someCluster; private static String someSecret; @Before public void setUp() throws Exception { someNamespace = "someName"; when(pollResponse.getStatusCode()).thenReturn(HttpServletResponse.SC_NOT_MODIFIED); configUtil = new MockConfigUtil(); MockInjector.setInstance(ConfigUtil.class, configUtil); someServerUrl = "http://someServer"; ServiceDTO serviceDTO = mock(ServiceDTO.class); when(serviceDTO.getHomepageUrl()).thenReturn(someServerUrl); when(configServiceLocator.getConfigServices()).thenReturn(Lists.newArrayList(serviceDTO)); MockInjector.setInstance(ConfigServiceLocator.class, configServiceLocator); httpUtil = spy(new MockHttpUtil()); MockInjector.setInstance(HttpUtil.class, httpUtil); remoteConfigLongPollService = new RemoteConfigLongPollService(); MockInjector.setInstance(RemoteConfigLongPollService.class, remoteConfigLongPollService); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new Properties(); } }); MockInjector.setInstance(PropertiesFactory.class, propertiesFactory); someAppId = "someAppId"; someCluster = "someCluster"; } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testLoadConfig() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test public void testLoadConfigWithOrderedProperties() throws Exception { String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newLinkedHashMap(); configurations.put(someKey, someValue); configurations.put("someKey2", "someValue2"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); when(propertiesFactory.getPropertiesInstance()).thenAnswer(new Answer<Properties>() { @Override public Properties answer(InvocationOnMock invocation) { return new OrderedProperties(); } }); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertTrue(config instanceof OrderedProperties); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); String[] actualArrays = config.keySet().toArray(new String[]{}); String[] expectedArrays = {"someKey", "someKey2"}; assertArrayEquals(expectedArrays, actualArrays); } @Test public void testLoadConfigWithAccessKeySecret() throws Exception { someSecret = "someSecret"; String someKey = "someKey"; String someValue = "someValue"; Map<String, String> configurations = Maps.newHashMap(); configurations.put(someKey, someValue); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); doAnswer(new Answer<HttpResponse<ApolloConfig>>() { @Override public HttpResponse<ApolloConfig> answer(InvocationOnMock invocation) throws Throwable { HttpRequest request = invocation.getArgumentAt(0, HttpRequest.class); Map<String, String> headers = request.getHeaders(); assertNotNull(headers); assertTrue(headers.containsKey(Signature.HTTP_HEADER_TIMESTAMP)); assertTrue(headers.containsKey(HttpHeaders.AUTHORIZATION)); return someResponse; } }).when(httpUtil).doGet(any(HttpRequest.class), any(Class.class)); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); Properties config = remoteConfigRepository.getConfig(); assertEquals(configurations, config); assertEquals(ConfigSourceType.REMOTE, remoteConfigRepository.getSourceType()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test(expected = ApolloConfigException.class) public void testGetRemoteConfigWithServerError() throws Exception { when(someResponse.getStatusCode()).thenReturn(500); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); //must stop the long polling before exception occurred remoteConfigLongPollService.stopLongPollingRefresh(); remoteConfigRepository.getConfig(); } @Test(expected = ApolloConfigException.class) public void testGetRemoteConfigWithNotFount() throws Exception { when(someResponse.getStatusCode()).thenReturn(404); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); //must stop the long polling before exception occurred remoteConfigLongPollService.stopLongPollingRefresh(); remoteConfigRepository.getConfig(); } @Test public void testRepositoryChangeListener() throws Exception { Map<String, String> configurations = ImmutableMap.of("someKey", "someValue"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); RepositoryChangeListener someListener = mock(RepositoryChangeListener.class); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); remoteConfigRepository.addChangeListener(someListener); final ArgumentCaptor<Properties> captor = ArgumentCaptor.forClass(Properties.class); Map<String, String> newConfigurations = ImmutableMap.of("someKey", "anotherValue"); ApolloConfig newApolloConfig = assembleApolloConfig(newConfigurations); when(someResponse.getBody()).thenReturn(newApolloConfig); remoteConfigRepository.sync(); verify(someListener, times(1)).onRepositoryChange(eq(someNamespace), captor.capture()); assertEquals(newConfigurations, captor.getValue()); remoteConfigLongPollService.stopLongPollingRefresh(); } @Test public void testLongPollingRefresh() throws Exception { Map<String, String> configurations = ImmutableMap.of("someKey", "someValue"); ApolloConfig someApolloConfig = assembleApolloConfig(configurations); when(someResponse.getStatusCode()).thenReturn(200); when(someResponse.getBody()).thenReturn(someApolloConfig); final SettableFuture<Boolean> longPollFinished = SettableFuture.create(); RepositoryChangeListener someListener = mock(RepositoryChangeListener.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { longPollFinished.set(true); return null; } }).when(someListener).onRepositoryChange(any(String.class), any(Properties.class)); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); remoteConfigRepository.addChangeListener(someListener); final ArgumentCaptor<Properties> captor = ArgumentCaptor.forClass(Properties.class); Map<String, String> newConfigurations = ImmutableMap.of("someKey", "anotherValue"); ApolloConfig newApolloConfig = assembleApolloConfig(newConfigurations); ApolloNotificationMessages notificationMessages = new ApolloNotificationMessages(); String someKey = "someKey"; long someNotificationId = 1; notificationMessages.put(someKey, someNotificationId); ApolloConfigNotification someNotification = mock(ApolloConfigNotification.class); when(someNotification.getNamespaceName()).thenReturn(someNamespace); when(someNotification.getMessages()).thenReturn(notificationMessages); when(pollResponse.getStatusCode()).thenReturn(HttpServletResponse.SC_OK); when(pollResponse.getBody()).thenReturn(Lists.newArrayList(someNotification)); when(someResponse.getBody()).thenReturn(newApolloConfig); longPollFinished.get(5000, TimeUnit.MILLISECONDS); remoteConfigLongPollService.stopLongPollingRefresh(); verify(someListener, times(1)).onRepositoryChange(eq(someNamespace), captor.capture()); assertEquals(newConfigurations, captor.getValue()); final ArgumentCaptor<HttpRequest> httpRequestArgumentCaptor = ArgumentCaptor .forClass(HttpRequest.class); verify(httpUtil, atLeast(2)).doGet(httpRequestArgumentCaptor.capture(), eq(ApolloConfig.class)); HttpRequest request = httpRequestArgumentCaptor.getValue(); assertTrue(request.getUrl().contains("messages=%7B%22details%22%3A%7B%22someKey%22%3A1%7D%7D")); } @Test public void testAssembleQueryConfigUrl() throws Exception { Gson gson = new Gson(); String someUri = "http://someServer"; String someAppId = "someAppId"; String someCluster = "someCluster+ &.-_someSign"; String someReleaseKey = "20160705193346-583078ef5716c055+20160705193308-31c471ddf9087c3f"; ApolloNotificationMessages notificationMessages = new ApolloNotificationMessages(); String someKey = "someKey"; long someNotificationId = 1; String anotherKey = "anotherKey"; long anotherNotificationId = 2; notificationMessages.put(someKey, someNotificationId); notificationMessages.put(anotherKey, anotherNotificationId); RemoteConfigRepository remoteConfigRepository = new RemoteConfigRepository(someNamespace); ApolloConfig someApolloConfig = mock(ApolloConfig.class); when(someApolloConfig.getReleaseKey()).thenReturn(someReleaseKey); String queryConfigUrl = remoteConfigRepository .assembleQueryConfigUrl(someUri, someAppId, someCluster, someNamespace, null, notificationMessages, someApolloConfig); remoteConfigLongPollService.stopLongPollingRefresh(); assertTrue(queryConfigUrl .contains( "http://someServer/configs/someAppId/someCluster+%20&.-_someSign/" + someNamespace)); assertTrue(queryConfigUrl .contains("releaseKey=20160705193346-583078ef5716c055%2B20160705193308-31c471ddf9087c3f")); assertTrue(queryConfigUrl .contains("messages=" + UrlEscapers.urlFormParameterEscaper() .escape(gson.toJson(notificationMessages)))); } private ApolloConfig assembleApolloConfig(Map<String, String> configurations) { String someAppId = "appId"; String someClusterName = "cluster"; String someReleaseKey = "1"; ApolloConfig apolloConfig = new ApolloConfig(someAppId, someClusterName, someNamespace, someReleaseKey); apolloConfig.setConfigurations(configurations); return apolloConfig; } public static class MockConfigUtil extends ConfigUtil { @Override public String getAppId() { return someAppId; } @Override public String getCluster() { return someCluster; } @Override public String getAccessKeySecret() { return someSecret; } @Override public String getDataCenter() { return null; } @Override public int getLoadConfigQPS() { return 200; } @Override public int getLongPollQPS() { return 200; } @Override public long getOnErrorRetryInterval() { return 10; } @Override public TimeUnit getOnErrorRetryIntervalTimeUnit() { return TimeUnit.MILLISECONDS; } @Override public long getLongPollingInitialDelayInMills() { return 0; } } public static class MockHttpUtil extends HttpUtil { @Override public <T> HttpResponse<T> doGet(HttpRequest httpRequest, Class<T> responseType) { if (someResponse.getStatusCode() == 200 || someResponse.getStatusCode() == 304) { return (HttpResponse<T>) someResponse; } throw new ApolloConfigStatusCodeException(someResponse.getStatusCode(), String.format("Http request failed due to status code: %d", someResponse.getStatusCode())); } @Override public <T> HttpResponse<T> doGet(HttpRequest httpRequest, Type responseType) { try { TimeUnit.MILLISECONDS.sleep(50); } catch (InterruptedException e) { } return (HttpResponse<T>) pollResponse; } } }
-1