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,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./.git/hooks/update.sample | #!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0
| #!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.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.service;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ReleaseMessageService {
private final ReleaseMessageRepository releaseMessageRepository;
public ReleaseMessageService(final ReleaseMessageRepository releaseMessageRepository) {
this.releaseMessageRepository = releaseMessageRepository;
}
public ReleaseMessage findLatestReleaseMessageForMessages(Collection<String> messages) {
if (CollectionUtils.isEmpty(messages)) {
return null;
}
return releaseMessageRepository.findTopByMessageInOrderByIdDesc(messages);
}
public List<ReleaseMessage> findLatestReleaseMessagesGroupByMessages(Collection<String> messages) {
if (CollectionUtils.isEmpty(messages)) {
return Collections.emptyList();
}
List<Object[]> result =
releaseMessageRepository.findLatestReleaseMessagesGroupByMessages(messages);
List<ReleaseMessage> releaseMessages = Lists.newArrayList();
for (Object[] o : result) {
try {
ReleaseMessage releaseMessage = new ReleaseMessage((String) o[0]);
releaseMessage.setId((Long) o[1]);
releaseMessages.add(releaseMessage);
} catch (Exception ex) {
Tracer.logError("Parsing LatestReleaseMessagesGroupByMessages failed", ex);
}
}
return releaseMessages;
}
}
| /*
* 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.service;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ReleaseMessageService {
private final ReleaseMessageRepository releaseMessageRepository;
public ReleaseMessageService(final ReleaseMessageRepository releaseMessageRepository) {
this.releaseMessageRepository = releaseMessageRepository;
}
public ReleaseMessage findLatestReleaseMessageForMessages(Collection<String> messages) {
if (CollectionUtils.isEmpty(messages)) {
return null;
}
return releaseMessageRepository.findTopByMessageInOrderByIdDesc(messages);
}
public List<ReleaseMessage> findLatestReleaseMessagesGroupByMessages(Collection<String> messages) {
if (CollectionUtils.isEmpty(messages)) {
return Collections.emptyList();
}
List<Object[]> result =
releaseMessageRepository.findLatestReleaseMessagesGroupByMessages(messages);
List<ReleaseMessage> releaseMessages = Lists.newArrayList();
for (Object[] o : result) {
try {
ReleaseMessage releaseMessage = new ReleaseMessage((String) o[0]);
releaseMessage.setId((Long) o[1]);
releaseMessages.add(releaseMessage);
} catch (Exception ex) {
Tracer.logError("Parsing LatestReleaseMessagesGroupByMessages failed", ex);
}
}
return releaseMessages;
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./docs/en/images/community/intellij-idea.svg | <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
<g>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7898" y1="40.0893" x2="33.3172" y2="40.0893">
<stop offset="0.2581" style="stop-color:#F97A12"/>
<stop offset="0.4591" style="stop-color:#B07B58"/>
<stop offset="0.7241" style="stop-color:#577BAE"/>
<stop offset="0.9105" style="stop-color:#1E7CE5"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_1_);" points="17.7,54.6 0.8,41.2 9.2,25.6 33.3,35 "/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="25.7674" y1="24.88" x2="79.424" y2="54.57">
<stop offset="0" style="stop-color:#F97A12"/>
<stop offset="7.179946e-002" style="stop-color:#CB7A3E"/>
<stop offset="0.1541" style="stop-color:#9E7B6A"/>
<stop offset="0.242" style="stop-color:#757B91"/>
<stop offset="0.3344" style="stop-color:#537BB1"/>
<stop offset="0.4324" style="stop-color:#387CCC"/>
<stop offset="0.5381" style="stop-color:#237CE0"/>
<stop offset="0.6552" style="stop-color:#147CEF"/>
<stop offset="0.7925" style="stop-color:#0B7CF7"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_2_);" points="70,18.7 68.7,59.2 41.8,70 25.6,59.6 49.3,35 38.9,12.3 48.2,1.1 "/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="63.2277" y1="42.9153" x2="48.2903" y2="-1.7191">
<stop offset="0" style="stop-color:#FE315D"/>
<stop offset="7.840246e-002" style="stop-color:#CB417E"/>
<stop offset="0.1601" style="stop-color:#9E4E9B"/>
<stop offset="0.2474" style="stop-color:#755BB4"/>
<stop offset="0.3392" style="stop-color:#5365CA"/>
<stop offset="0.4365" style="stop-color:#386DDB"/>
<stop offset="0.5414" style="stop-color:#2374E9"/>
<stop offset="0.6576" style="stop-color:#1478F3"/>
<stop offset="0.794" style="stop-color:#0B7BF8"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_3_);" points="70,18.7 48.7,43.9 38.9,12.3 48.2,1.1 "/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="10.7204" y1="16.473" x2="55.5237" y2="90.58">
<stop offset="0" style="stop-color:#FE315D"/>
<stop offset="4.023279e-002" style="stop-color:#F63462"/>
<stop offset="0.1037" style="stop-color:#DF3A71"/>
<stop offset="0.1667" style="stop-color:#C24383"/>
<stop offset="0.2912" style="stop-color:#AD4A91"/>
<stop offset="0.5498" style="stop-color:#755BB4"/>
<stop offset="0.9175" style="stop-color:#1D76ED"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_4_);" points="33.7,58.1 5.6,68.3 10.1,52.5 16,33.1 0,27.7 10.1,0 32.1,2.7 53.7,27.4 "/>
</g>
<g>
<rect x="13.7" y="13.5" style="fill:#000000;" width="43.2" height="43.2"/>
<rect x="17.7" y="48.6" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
<polygon style="fill:#FFFFFF;" points="29.4,22.4 29.4,19.1 20.4,19.1 20.4,22.4 23,22.4 23,33.7 20.4,33.7 20.4,37 29.4,37
29.4,33.7 26.9,33.7 26.9,22.4 "/>
<path style="fill:#FFFFFF;" d="M38,37.3c-1.4,0-2.6-0.3-3.5-0.8c-0.9-0.5-1.7-1.2-2.3-1.9l2.5-2.8c0.5,0.6,1,1,1.5,1.3
c0.5,0.3,1.1,0.5,1.7,0.5c0.7,0,1.3-0.2,1.8-0.7c0.4-0.5,0.6-1.2,0.6-2.3V19.1h4v11.7c0,1.1-0.1,2-0.4,2.8c-0.3,0.8-0.7,1.4-1.3,2
c-0.5,0.5-1.2,1-2,1.2C39.8,37.1,39,37.3,38,37.3"/>
</g>
</g>
</svg>
| <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
<g>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7898" y1="40.0893" x2="33.3172" y2="40.0893">
<stop offset="0.2581" style="stop-color:#F97A12"/>
<stop offset="0.4591" style="stop-color:#B07B58"/>
<stop offset="0.7241" style="stop-color:#577BAE"/>
<stop offset="0.9105" style="stop-color:#1E7CE5"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_1_);" points="17.7,54.6 0.8,41.2 9.2,25.6 33.3,35 "/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="25.7674" y1="24.88" x2="79.424" y2="54.57">
<stop offset="0" style="stop-color:#F97A12"/>
<stop offset="7.179946e-002" style="stop-color:#CB7A3E"/>
<stop offset="0.1541" style="stop-color:#9E7B6A"/>
<stop offset="0.242" style="stop-color:#757B91"/>
<stop offset="0.3344" style="stop-color:#537BB1"/>
<stop offset="0.4324" style="stop-color:#387CCC"/>
<stop offset="0.5381" style="stop-color:#237CE0"/>
<stop offset="0.6552" style="stop-color:#147CEF"/>
<stop offset="0.7925" style="stop-color:#0B7CF7"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_2_);" points="70,18.7 68.7,59.2 41.8,70 25.6,59.6 49.3,35 38.9,12.3 48.2,1.1 "/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="63.2277" y1="42.9153" x2="48.2903" y2="-1.7191">
<stop offset="0" style="stop-color:#FE315D"/>
<stop offset="7.840246e-002" style="stop-color:#CB417E"/>
<stop offset="0.1601" style="stop-color:#9E4E9B"/>
<stop offset="0.2474" style="stop-color:#755BB4"/>
<stop offset="0.3392" style="stop-color:#5365CA"/>
<stop offset="0.4365" style="stop-color:#386DDB"/>
<stop offset="0.5414" style="stop-color:#2374E9"/>
<stop offset="0.6576" style="stop-color:#1478F3"/>
<stop offset="0.794" style="stop-color:#0B7BF8"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_3_);" points="70,18.7 48.7,43.9 38.9,12.3 48.2,1.1 "/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="10.7204" y1="16.473" x2="55.5237" y2="90.58">
<stop offset="0" style="stop-color:#FE315D"/>
<stop offset="4.023279e-002" style="stop-color:#F63462"/>
<stop offset="0.1037" style="stop-color:#DF3A71"/>
<stop offset="0.1667" style="stop-color:#C24383"/>
<stop offset="0.2912" style="stop-color:#AD4A91"/>
<stop offset="0.5498" style="stop-color:#755BB4"/>
<stop offset="0.9175" style="stop-color:#1D76ED"/>
<stop offset="1" style="stop-color:#087CFA"/>
</linearGradient>
<polygon style="fill:url(#SVGID_4_);" points="33.7,58.1 5.6,68.3 10.1,52.5 16,33.1 0,27.7 10.1,0 32.1,2.7 53.7,27.4 "/>
</g>
<g>
<rect x="13.7" y="13.5" style="fill:#000000;" width="43.2" height="43.2"/>
<rect x="17.7" y="48.6" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
<polygon style="fill:#FFFFFF;" points="29.4,22.4 29.4,19.1 20.4,19.1 20.4,22.4 23,22.4 23,33.7 20.4,33.7 20.4,37 29.4,37
29.4,33.7 26.9,33.7 26.9,22.4 "/>
<path style="fill:#FFFFFF;" d="M38,37.3c-1.4,0-2.6-0.3-3.5-0.8c-0.9-0.5-1.7-1.2-2.3-1.9l2.5-2.8c0.5,0.6,1,1,1.5,1.3
c0.5,0.3,1.1,0.5,1.7,0.5c0.7,0,1.3-0.2,1.8-0.7c0.4-0.5,0.6-1.2,0.6-2.3V19.1h4v11.7c0,1.1-0.1,2-0.4,2.8c-0.3,0.8-0.7,1.4-1.3,2
c-0.5,0.5-1.2,1-2,1.2C39.8,37.1,39,37.3,38,37.3"/>
</g>
</g>
</svg>
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-adminservice/src/test/resources/filter/test-access-control-enabled.sql | --
-- 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.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
VALUES
('admin-service.access.tokens', 'default', 'someToken,anotherToken'),
('admin-service.access.control.enabled', 'default', 'true');
| --
-- 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.
--
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`)
VALUES
('admin-service.access.tokens', 'default', 'someToken,anotherToken'),
('admin-service.access.control.enabled', 'default', 'true');
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/NormalPublishEmailBuilder.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.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO;
import org.springframework.stereotype.Component;
@Component
public class NormalPublishEmailBuilder extends ConfigPublishEmailBuilder {
private static final String EMAIL_SUBJECT = "[Apollo] 配置发布";
@Override
protected String subject() {
return EMAIL_SUBJECT;
}
@Override
protected String emailContent(Env env, ReleaseHistoryBO releaseHistory) {
return renderEmailCommonContent(env, releaseHistory);
}
@Override
protected String getTemplateFramework() {
return portalConfig.emailTemplateFramework();
}
@Override
protected String getDiffModuleTemplate() {
return portalConfig.emailReleaseDiffModuleTemplate();
}
}
| /*
* 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.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO;
import org.springframework.stereotype.Component;
@Component
public class NormalPublishEmailBuilder extends ConfigPublishEmailBuilder {
private static final String EMAIL_SUBJECT = "[Apollo] 配置发布";
@Override
protected String subject() {
return EMAIL_SUBJECT;
}
@Override
protected String emailContent(Env env, ReleaseHistoryBO releaseHistory) {
return renderEmailCommonContent(env, releaseHistory);
}
@Override
protected String getTemplateFramework() {
return portalConfig.emailTemplateFramework();
}
@Override
protected String getDiffModuleTemplate() {
return portalConfig.emailReleaseDiffModuleTemplate();
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/util/OpenApiBeanUtils.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.util;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.util.CollectionUtils;
import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleDTO;
import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleItemDTO;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.entity.App;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleItemDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO;
import com.ctrip.framework.apollo.portal.entity.bo.ItemBO;
import com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO;
import com.google.common.base.Preconditions;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
public class OpenApiBeanUtils {
private static final Gson GSON = new Gson();
private static Type type = new TypeToken<Map<String, String>>() {}.getType();
public static OpenItemDTO transformFromItemDTO(ItemDTO item) {
Preconditions.checkArgument(item != null);
return BeanUtils.transform(OpenItemDTO.class, item);
}
public static ItemDTO transformToItemDTO(OpenItemDTO openItemDTO) {
Preconditions.checkArgument(openItemDTO != null);
return BeanUtils.transform(ItemDTO.class, openItemDTO);
}
public static OpenAppNamespaceDTO transformToOpenAppNamespaceDTO(AppNamespace appNamespace) {
Preconditions.checkArgument(appNamespace != null);
return BeanUtils.transform(OpenAppNamespaceDTO.class, appNamespace);
}
public static AppNamespace transformToAppNamespace(OpenAppNamespaceDTO openAppNamespaceDTO) {
Preconditions.checkArgument(openAppNamespaceDTO != null);
return BeanUtils.transform(AppNamespace.class, openAppNamespaceDTO);
}
public static OpenReleaseDTO transformFromReleaseDTO(ReleaseDTO release) {
Preconditions.checkArgument(release != null);
OpenReleaseDTO openReleaseDTO = BeanUtils.transform(OpenReleaseDTO.class, release);
Map<String, String> configs = GSON.fromJson(release.getConfigurations(), type);
openReleaseDTO.setConfigurations(configs);
return openReleaseDTO;
}
public static OpenNamespaceDTO transformFromNamespaceBO(NamespaceBO namespaceBO) {
Preconditions.checkArgument(namespaceBO != null);
OpenNamespaceDTO openNamespaceDTO =
BeanUtils.transform(OpenNamespaceDTO.class, namespaceBO.getBaseInfo());
// app namespace info
openNamespaceDTO.setFormat(namespaceBO.getFormat());
openNamespaceDTO.setComment(namespaceBO.getComment());
openNamespaceDTO.setPublic(namespaceBO.isPublic());
// items
List<OpenItemDTO> items = new LinkedList<>();
List<ItemBO> itemBOs = namespaceBO.getItems();
if (!CollectionUtils.isEmpty(itemBOs)) {
items.addAll(itemBOs.stream().map(itemBO -> transformFromItemDTO(itemBO.getItem()))
.collect(Collectors.toList()));
}
openNamespaceDTO.setItems(items);
return openNamespaceDTO;
}
public static List<OpenNamespaceDTO> batchTransformFromNamespaceBOs(
List<NamespaceBO> namespaceBOs) {
if (CollectionUtils.isEmpty(namespaceBOs)) {
return Collections.emptyList();
}
List<OpenNamespaceDTO> openNamespaceDTOs =
namespaceBOs.stream().map(OpenApiBeanUtils::transformFromNamespaceBO)
.collect(Collectors.toCollection(LinkedList::new));
return openNamespaceDTOs;
}
public static OpenNamespaceLockDTO transformFromNamespaceLockDTO(String namespaceName,
NamespaceLockDTO namespaceLock) {
OpenNamespaceLockDTO lock = new OpenNamespaceLockDTO();
lock.setNamespaceName(namespaceName);
if (namespaceLock == null) {
lock.setLocked(false);
} else {
lock.setLocked(true);
lock.setLockedBy(namespaceLock.getDataChangeCreatedBy());
}
return lock;
}
public static OpenGrayReleaseRuleDTO transformFromGrayReleaseRuleDTO(
GrayReleaseRuleDTO grayReleaseRuleDTO) {
Preconditions.checkArgument(grayReleaseRuleDTO != null);
return BeanUtils.transform(OpenGrayReleaseRuleDTO.class, grayReleaseRuleDTO);
}
public static GrayReleaseRuleDTO transformToGrayReleaseRuleDTO(
OpenGrayReleaseRuleDTO openGrayReleaseRuleDTO) {
Preconditions.checkArgument(openGrayReleaseRuleDTO != null);
String appId = openGrayReleaseRuleDTO.getAppId();
String branchName = openGrayReleaseRuleDTO.getBranchName();
String clusterName = openGrayReleaseRuleDTO.getClusterName();
String namespaceName = openGrayReleaseRuleDTO.getNamespaceName();
GrayReleaseRuleDTO grayReleaseRuleDTO =
new GrayReleaseRuleDTO(appId, clusterName, namespaceName, branchName);
Set<OpenGrayReleaseRuleItemDTO> openGrayReleaseRuleItemDTOSet =
openGrayReleaseRuleDTO.getRuleItems();
openGrayReleaseRuleItemDTOSet.forEach(openGrayReleaseRuleItemDTO -> {
String clientAppId = openGrayReleaseRuleItemDTO.getClientAppId();
Set<String> clientIpList = openGrayReleaseRuleItemDTO.getClientIpList();
GrayReleaseRuleItemDTO ruleItem = new GrayReleaseRuleItemDTO(clientAppId, clientIpList);
grayReleaseRuleDTO.addRuleItem(ruleItem);
});
return grayReleaseRuleDTO;
}
public static List<OpenAppDTO> transformFromApps(final List<App> apps) {
if (CollectionUtils.isEmpty(apps)) {
return Collections.emptyList();
}
return apps.stream().map(OpenApiBeanUtils::transformFromApp).collect(Collectors.toList());
}
public static OpenAppDTO transformFromApp(final App app) {
Preconditions.checkArgument(app != null);
return BeanUtils.transform(OpenAppDTO.class, app);
}
public static OpenClusterDTO transformFromClusterDTO(ClusterDTO Cluster) {
Preconditions.checkArgument(Cluster != null);
return BeanUtils.transform(OpenClusterDTO.class, Cluster);
}
public static ClusterDTO transformToClusterDTO(OpenClusterDTO openClusterDTO) {
Preconditions.checkArgument(openClusterDTO != null);
return BeanUtils.transform(ClusterDTO.class, openClusterDTO);
}
}
| /*
* 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.util;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.util.CollectionUtils;
import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleDTO;
import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleItemDTO;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.entity.App;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenGrayReleaseRuleItemDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO;
import com.ctrip.framework.apollo.portal.entity.bo.ItemBO;
import com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO;
import com.google.common.base.Preconditions;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
public class OpenApiBeanUtils {
private static final Gson GSON = new Gson();
private static Type type = new TypeToken<Map<String, String>>() {}.getType();
public static OpenItemDTO transformFromItemDTO(ItemDTO item) {
Preconditions.checkArgument(item != null);
return BeanUtils.transform(OpenItemDTO.class, item);
}
public static ItemDTO transformToItemDTO(OpenItemDTO openItemDTO) {
Preconditions.checkArgument(openItemDTO != null);
return BeanUtils.transform(ItemDTO.class, openItemDTO);
}
public static OpenAppNamespaceDTO transformToOpenAppNamespaceDTO(AppNamespace appNamespace) {
Preconditions.checkArgument(appNamespace != null);
return BeanUtils.transform(OpenAppNamespaceDTO.class, appNamespace);
}
public static AppNamespace transformToAppNamespace(OpenAppNamespaceDTO openAppNamespaceDTO) {
Preconditions.checkArgument(openAppNamespaceDTO != null);
return BeanUtils.transform(AppNamespace.class, openAppNamespaceDTO);
}
public static OpenReleaseDTO transformFromReleaseDTO(ReleaseDTO release) {
Preconditions.checkArgument(release != null);
OpenReleaseDTO openReleaseDTO = BeanUtils.transform(OpenReleaseDTO.class, release);
Map<String, String> configs = GSON.fromJson(release.getConfigurations(), type);
openReleaseDTO.setConfigurations(configs);
return openReleaseDTO;
}
public static OpenNamespaceDTO transformFromNamespaceBO(NamespaceBO namespaceBO) {
Preconditions.checkArgument(namespaceBO != null);
OpenNamespaceDTO openNamespaceDTO =
BeanUtils.transform(OpenNamespaceDTO.class, namespaceBO.getBaseInfo());
// app namespace info
openNamespaceDTO.setFormat(namespaceBO.getFormat());
openNamespaceDTO.setComment(namespaceBO.getComment());
openNamespaceDTO.setPublic(namespaceBO.isPublic());
// items
List<OpenItemDTO> items = new LinkedList<>();
List<ItemBO> itemBOs = namespaceBO.getItems();
if (!CollectionUtils.isEmpty(itemBOs)) {
items.addAll(itemBOs.stream().map(itemBO -> transformFromItemDTO(itemBO.getItem()))
.collect(Collectors.toList()));
}
openNamespaceDTO.setItems(items);
return openNamespaceDTO;
}
public static List<OpenNamespaceDTO> batchTransformFromNamespaceBOs(
List<NamespaceBO> namespaceBOs) {
if (CollectionUtils.isEmpty(namespaceBOs)) {
return Collections.emptyList();
}
List<OpenNamespaceDTO> openNamespaceDTOs =
namespaceBOs.stream().map(OpenApiBeanUtils::transformFromNamespaceBO)
.collect(Collectors.toCollection(LinkedList::new));
return openNamespaceDTOs;
}
public static OpenNamespaceLockDTO transformFromNamespaceLockDTO(String namespaceName,
NamespaceLockDTO namespaceLock) {
OpenNamespaceLockDTO lock = new OpenNamespaceLockDTO();
lock.setNamespaceName(namespaceName);
if (namespaceLock == null) {
lock.setLocked(false);
} else {
lock.setLocked(true);
lock.setLockedBy(namespaceLock.getDataChangeCreatedBy());
}
return lock;
}
public static OpenGrayReleaseRuleDTO transformFromGrayReleaseRuleDTO(
GrayReleaseRuleDTO grayReleaseRuleDTO) {
Preconditions.checkArgument(grayReleaseRuleDTO != null);
return BeanUtils.transform(OpenGrayReleaseRuleDTO.class, grayReleaseRuleDTO);
}
public static GrayReleaseRuleDTO transformToGrayReleaseRuleDTO(
OpenGrayReleaseRuleDTO openGrayReleaseRuleDTO) {
Preconditions.checkArgument(openGrayReleaseRuleDTO != null);
String appId = openGrayReleaseRuleDTO.getAppId();
String branchName = openGrayReleaseRuleDTO.getBranchName();
String clusterName = openGrayReleaseRuleDTO.getClusterName();
String namespaceName = openGrayReleaseRuleDTO.getNamespaceName();
GrayReleaseRuleDTO grayReleaseRuleDTO =
new GrayReleaseRuleDTO(appId, clusterName, namespaceName, branchName);
Set<OpenGrayReleaseRuleItemDTO> openGrayReleaseRuleItemDTOSet =
openGrayReleaseRuleDTO.getRuleItems();
openGrayReleaseRuleItemDTOSet.forEach(openGrayReleaseRuleItemDTO -> {
String clientAppId = openGrayReleaseRuleItemDTO.getClientAppId();
Set<String> clientIpList = openGrayReleaseRuleItemDTO.getClientIpList();
GrayReleaseRuleItemDTO ruleItem = new GrayReleaseRuleItemDTO(clientAppId, clientIpList);
grayReleaseRuleDTO.addRuleItem(ruleItem);
});
return grayReleaseRuleDTO;
}
public static List<OpenAppDTO> transformFromApps(final List<App> apps) {
if (CollectionUtils.isEmpty(apps)) {
return Collections.emptyList();
}
return apps.stream().map(OpenApiBeanUtils::transformFromApp).collect(Collectors.toList());
}
public static OpenAppDTO transformFromApp(final App app) {
Preconditions.checkArgument(app != null);
return BeanUtils.transform(OpenAppDTO.class, app);
}
public static OpenClusterDTO transformFromClusterDTO(ClusterDTO Cluster) {
Preconditions.checkArgument(Cluster != null);
return BeanUtils.transform(OpenClusterDTO.class, Cluster);
}
public static ClusterDTO transformToClusterDTO(OpenClusterDTO openClusterDTO) {
Preconditions.checkArgument(openClusterDTO != null);
return BeanUtils.transform(ClusterDTO.class, openClusterDTO);
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./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()">
<!--
~ 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.
~
-->
<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">×</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()">
<!--
~ 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.
~
-->
<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">×</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,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-client/src/main/resources/META-INF/spring.schemas | http\://www.ctrip.com/schema/apollo-1.0.0.xsd=/META-INF/apollo-1.0.0.xsd
http\://www.ctrip.com/schema/apollo.xsd=/META-INF/apollo-1.0.0.xsd
| http\://www.ctrip.com/schema/apollo-1.0.0.xsd=/META-INF/apollo-1.0.0.xsd
http\://www.ctrip.com/schema/apollo.xsd=/META-INF/apollo-1.0.0.xsd
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AccessKeyController.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.AccessKey;
import com.ctrip.framework.apollo.biz.service.AccessKeyService;
import com.ctrip.framework.apollo.common.dto.AccessKeyDTO;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import java.util.List;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author nisiyong
*/
@RestController
public class AccessKeyController {
private final AccessKeyService accessKeyService;
public AccessKeyController(
AccessKeyService accessKeyService) {
this.accessKeyService = accessKeyService;
}
@PostMapping(value = "/apps/{appId}/accesskeys")
public AccessKeyDTO create(@PathVariable String appId, @RequestBody AccessKeyDTO dto) {
AccessKey entity = BeanUtils.transform(AccessKey.class, dto);
entity = accessKeyService.create(appId, entity);
return BeanUtils.transform(AccessKeyDTO.class, entity);
}
@GetMapping(value = "/apps/{appId}/accesskeys")
public List<AccessKeyDTO> findByAppId(@PathVariable String appId) {
List<AccessKey> accessKeyList = accessKeyService.findByAppId(appId);
return BeanUtils.batchTransform(AccessKeyDTO.class, accessKeyList);
}
@DeleteMapping(value = "/apps/{appId}/accesskeys/{id}")
public void delete(@PathVariable String appId, @PathVariable long id, String operator) {
accessKeyService.delete(appId, id, operator);
}
@PutMapping(value = "/apps/{appId}/accesskeys/{id}/enable")
public void enable(@PathVariable String appId, @PathVariable long id, String operator) {
AccessKey entity = new AccessKey();
entity.setId(id);
entity.setEnabled(true);
entity.setDataChangeLastModifiedBy(operator);
accessKeyService.update(appId, entity);
}
@PutMapping(value = "/apps/{appId}/accesskeys/{id}/disable")
public void disable(@PathVariable String appId, @PathVariable long id, String operator) {
AccessKey entity = new AccessKey();
entity.setId(id);
entity.setEnabled(false);
entity.setDataChangeLastModifiedBy(operator);
accessKeyService.update(appId, entity);
}
}
| /*
* 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.AccessKey;
import com.ctrip.framework.apollo.biz.service.AccessKeyService;
import com.ctrip.framework.apollo.common.dto.AccessKeyDTO;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import java.util.List;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author nisiyong
*/
@RestController
public class AccessKeyController {
private final AccessKeyService accessKeyService;
public AccessKeyController(
AccessKeyService accessKeyService) {
this.accessKeyService = accessKeyService;
}
@PostMapping(value = "/apps/{appId}/accesskeys")
public AccessKeyDTO create(@PathVariable String appId, @RequestBody AccessKeyDTO dto) {
AccessKey entity = BeanUtils.transform(AccessKey.class, dto);
entity = accessKeyService.create(appId, entity);
return BeanUtils.transform(AccessKeyDTO.class, entity);
}
@GetMapping(value = "/apps/{appId}/accesskeys")
public List<AccessKeyDTO> findByAppId(@PathVariable String appId) {
List<AccessKey> accessKeyList = accessKeyService.findByAppId(appId);
return BeanUtils.batchTransform(AccessKeyDTO.class, accessKeyList);
}
@DeleteMapping(value = "/apps/{appId}/accesskeys/{id}")
public void delete(@PathVariable String appId, @PathVariable long id, String operator) {
accessKeyService.delete(appId, id, operator);
}
@PutMapping(value = "/apps/{appId}/accesskeys/{id}/enable")
public void enable(@PathVariable String appId, @PathVariable long id, String operator) {
AccessKey entity = new AccessKey();
entity.setId(id);
entity.setEnabled(true);
entity.setDataChangeLastModifiedBy(operator);
accessKeyService.update(appId, entity);
}
@PutMapping(value = "/apps/{appId}/accesskeys/{id}/disable")
public void disable(@PathVariable String appId, @PathVariable long id, String operator) {
AccessKey entity = new AccessKey();
entity.setId(id);
entity.setEnabled(false);
entity.setDataChangeLastModifiedBy(operator);
accessKeyService.update(appId, entity);
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/DefaultHttpClient.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.util.http;
import com.ctrip.framework.apollo.build.ApolloInjector;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
import com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.google.common.base.Function;
import com.google.common.io.CharStreams;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class DefaultHttpClient implements HttpClient {
private ConfigUtil m_configUtil;
private static final Gson GSON = new Gson();
/**
* Constructor.
*/
public DefaultHttpClient() {
m_configUtil = ApolloInjector.getInstance(ConfigUtil.class);
}
/**
* Do get operation for the http request.
*
* @param httpRequest the request
* @param responseType the response type
* @return the response
* @throws ApolloConfigException if any error happened or response code is neither 200 nor 304
*/
@Override
public <T> HttpResponse<T> doGet(HttpRequest httpRequest, final Class<T> responseType) {
Function<String, T> convertResponse = new Function<String, T>() {
@Override
public T apply(String input) {
return GSON.fromJson(input, responseType);
}
};
return doGetWithSerializeFunction(httpRequest, convertResponse);
}
/**
* Do get operation for the http request.
*
* @param httpRequest the request
* @param responseType the response type
* @return the response
* @throws ApolloConfigException if any error happened or response code is neither 200 nor 304
*/
@Override
public <T> HttpResponse<T> doGet(HttpRequest httpRequest, final Type responseType) {
Function<String, T> convertResponse = new Function<String, T>() {
@Override
public T apply(String input) {
return GSON.fromJson(input, responseType);
}
};
return doGetWithSerializeFunction(httpRequest, convertResponse);
}
private <T> HttpResponse<T> doGetWithSerializeFunction(HttpRequest httpRequest,
Function<String, T> serializeFunction) {
InputStreamReader isr = null;
InputStreamReader esr = null;
int statusCode;
try {
HttpURLConnection conn = (HttpURLConnection) new URL(httpRequest.getUrl()).openConnection();
conn.setRequestMethod("GET");
Map<String, String> headers = httpRequest.getHeaders();
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
}
int connectTimeout = httpRequest.getConnectTimeout();
if (connectTimeout < 0) {
connectTimeout = m_configUtil.getConnectTimeout();
}
int readTimeout = httpRequest.getReadTimeout();
if (readTimeout < 0) {
readTimeout = m_configUtil.getReadTimeout();
}
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
conn.connect();
statusCode = conn.getResponseCode();
String response;
try {
isr = new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8);
response = CharStreams.toString(isr);
} catch (IOException ex) {
/**
* according to https://docs.oracle.com/javase/7/docs/technotes/guides/net/http-keepalive.html,
* we should clean up the connection by reading the response body so that the connection
* could be reused.
*/
InputStream errorStream = conn.getErrorStream();
if (errorStream != null) {
esr = new InputStreamReader(errorStream, StandardCharsets.UTF_8);
try {
CharStreams.toString(esr);
} catch (IOException ioe) {
//ignore
}
}
// 200 and 304 should not trigger IOException, thus we must throw the original exception out
if (statusCode == 200 || statusCode == 304) {
throw ex;
}
// for status codes like 404, IOException is expected when calling conn.getInputStream()
throw new ApolloConfigStatusCodeException(statusCode, ex);
}
if (statusCode == 200) {
return new HttpResponse<>(statusCode, serializeFunction.apply(response));
}
if (statusCode == 304) {
return new HttpResponse<>(statusCode, null);
}
} catch (ApolloConfigStatusCodeException ex) {
throw ex;
} catch (Throwable ex) {
throw new ApolloConfigException("Could not complete get operation", ex);
} finally {
if (isr != null) {
try {
isr.close();
} catch (IOException ex) {
// ignore
}
}
if (esr != null) {
try {
esr.close();
} catch (IOException ex) {
// ignore
}
}
}
throw new ApolloConfigStatusCodeException(statusCode,
String.format("Get operation failed for %s", httpRequest.getUrl()));
}
}
| /*
* 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.util.http;
import com.ctrip.framework.apollo.build.ApolloInjector;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
import com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.google.common.base.Function;
import com.google.common.io.CharStreams;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class DefaultHttpClient implements HttpClient {
private ConfigUtil m_configUtil;
private static final Gson GSON = new Gson();
/**
* Constructor.
*/
public DefaultHttpClient() {
m_configUtil = ApolloInjector.getInstance(ConfigUtil.class);
}
/**
* Do get operation for the http request.
*
* @param httpRequest the request
* @param responseType the response type
* @return the response
* @throws ApolloConfigException if any error happened or response code is neither 200 nor 304
*/
@Override
public <T> HttpResponse<T> doGet(HttpRequest httpRequest, final Class<T> responseType) {
Function<String, T> convertResponse = new Function<String, T>() {
@Override
public T apply(String input) {
return GSON.fromJson(input, responseType);
}
};
return doGetWithSerializeFunction(httpRequest, convertResponse);
}
/**
* Do get operation for the http request.
*
* @param httpRequest the request
* @param responseType the response type
* @return the response
* @throws ApolloConfigException if any error happened or response code is neither 200 nor 304
*/
@Override
public <T> HttpResponse<T> doGet(HttpRequest httpRequest, final Type responseType) {
Function<String, T> convertResponse = new Function<String, T>() {
@Override
public T apply(String input) {
return GSON.fromJson(input, responseType);
}
};
return doGetWithSerializeFunction(httpRequest, convertResponse);
}
private <T> HttpResponse<T> doGetWithSerializeFunction(HttpRequest httpRequest,
Function<String, T> serializeFunction) {
InputStreamReader isr = null;
InputStreamReader esr = null;
int statusCode;
try {
HttpURLConnection conn = (HttpURLConnection) new URL(httpRequest.getUrl()).openConnection();
conn.setRequestMethod("GET");
Map<String, String> headers = httpRequest.getHeaders();
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
}
int connectTimeout = httpRequest.getConnectTimeout();
if (connectTimeout < 0) {
connectTimeout = m_configUtil.getConnectTimeout();
}
int readTimeout = httpRequest.getReadTimeout();
if (readTimeout < 0) {
readTimeout = m_configUtil.getReadTimeout();
}
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
conn.connect();
statusCode = conn.getResponseCode();
String response;
try {
isr = new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8);
response = CharStreams.toString(isr);
} catch (IOException ex) {
/**
* according to https://docs.oracle.com/javase/7/docs/technotes/guides/net/http-keepalive.html,
* we should clean up the connection by reading the response body so that the connection
* could be reused.
*/
InputStream errorStream = conn.getErrorStream();
if (errorStream != null) {
esr = new InputStreamReader(errorStream, StandardCharsets.UTF_8);
try {
CharStreams.toString(esr);
} catch (IOException ioe) {
//ignore
}
}
// 200 and 304 should not trigger IOException, thus we must throw the original exception out
if (statusCode == 200 || statusCode == 304) {
throw ex;
}
// for status codes like 404, IOException is expected when calling conn.getInputStream()
throw new ApolloConfigStatusCodeException(statusCode, ex);
}
if (statusCode == 200) {
return new HttpResponse<>(statusCode, serializeFunction.apply(response));
}
if (statusCode == 304) {
return new HttpResponse<>(statusCode, null);
}
} catch (ApolloConfigStatusCodeException ex) {
throw ex;
} catch (Throwable ex) {
throw new ApolloConfigException("Could not complete get operation", ex);
} finally {
if (isr != null) {
try {
isr.close();
} catch (IOException ex) {
// ignore
}
}
if (esr != null) {
try {
esr.close();
} catch (IOException ex) {
// ignore
}
}
}
throw new ApolloConfigStatusCodeException(statusCode,
String.format("Get operation failed for %s", httpRequest.getUrl()));
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/resources/static/vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(t){"use strict";var n;if(1===angular.version.major&&4<=angular.version.minor){var o=t.get("$cookies");n={get:function(t){return o.get(t)},put:function(t,e){o.put(t,e)}}}else{var r=t.get("$cookieStore");n={get:function(t){return r.get(t)},put:function(t,e){r.put(t,e)}}}return{get:function(t){return n.get(t)},set:function(t,e){n.put(t,e)},put:function(t,e){n.put(t,e)}}}return t.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",t),t.displayName="$translateCookieStorage","pascalprecht.translate"}); | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(t){"use strict";var n;if(1===angular.version.major&&4<=angular.version.minor){var o=t.get("$cookies");n={get:function(t){return o.get(t)},put:function(t,e){o.put(t,e)}}}else{var r=t.get("$cookieStore");n={get:function(t){return r.get(t)},put:function(t,e){r.put(t,e)}}}return{get:function(t){return n.get(t)},set:function(t,e){n.put(t,e)},put:function(t,e){n.put(t,e)}}}return t.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",t),t.displayName="$translateCookieStorage","pascalprecht.translate"}); | -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-core/src/main/java/com/ctrip/framework/apollo/core/MetaDomainConsts.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;
import com.ctrip.framework.apollo.core.enums.Env;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import com.ctrip.framework.apollo.core.utils.DeferredLoggerFactory;
import org.slf4j.Logger;
import com.ctrip.framework.apollo.core.spi.MetaServerProvider;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.core.utils.NetUtil;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.foundation.internals.ServiceBootstrap;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
/**
* The meta domain will try to load the meta server address from MetaServerProviders, the default
* ones are:
*
* <ul>
* <li>com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider</li>
* </ul>
* <p>
* If no provider could provide the meta server url, the default meta url will be used(http://apollo.meta).
* <br />
* <p>
* 3rd party MetaServerProvider could be injected by typical Java Service Loader pattern.
*
* @see com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider
*/
public class MetaDomainConsts {
public static final String DEFAULT_META_URL = "http://apollo.meta";
// env -> meta server address cache
private static final Map<Env, String> metaServerAddressCache = Maps.newConcurrentMap();
private static volatile List<MetaServerProvider> metaServerProviders = null;
private static final long REFRESH_INTERVAL_IN_SECOND = 60;// 1 min
private static final Logger logger = DeferredLoggerFactory.getLogger(MetaDomainConsts.class);
// comma separated meta server address -> selected single meta server address cache
private static final Map<String, String> selectedMetaServerAddressCache = Maps.newConcurrentMap();
private static final AtomicBoolean periodicRefreshStarted = new AtomicBoolean(false);
private static final Object LOCK = new Object();
/**
* Return one meta server address. If multiple meta server addresses are configured, will select
* one.
*/
public static String getDomain(Env env) {
String metaServerAddress = getMetaServerAddress(env);
// if there is more than one address, need to select one
if (metaServerAddress.contains(",")) {
return selectMetaServerAddress(metaServerAddress);
}
return metaServerAddress;
}
/**
* Return meta server address. If multiple meta server addresses are configured, will return the
* comma separated string.
*/
public static String getMetaServerAddress(Env env) {
if (!metaServerAddressCache.containsKey(env)) {
initMetaServerAddress(env);
}
return metaServerAddressCache.get(env);
}
private static void initMetaServerAddress(Env env) {
if (metaServerProviders == null) {
synchronized (LOCK) {
if (metaServerProviders == null) {
metaServerProviders = initMetaServerProviders();
}
}
}
String metaAddress = null;
for (MetaServerProvider provider : metaServerProviders) {
metaAddress = provider.getMetaServerAddress(env);
if (!Strings.isNullOrEmpty(metaAddress)) {
logger.info("Located meta server address {} for env {} from {}", metaAddress, env,
provider.getClass().getName());
break;
}
}
if (Strings.isNullOrEmpty(metaAddress)) {
// Fallback to default meta address
metaAddress = DEFAULT_META_URL;
logger.warn(
"Meta server address fallback to {} for env {}, because it is not available in all MetaServerProviders",
metaAddress, env);
}
metaServerAddressCache.put(env, metaAddress.trim());
}
private static List<MetaServerProvider> initMetaServerProviders() {
Iterator<MetaServerProvider> metaServerProviderIterator = ServiceBootstrap
.loadAll(MetaServerProvider.class);
List<MetaServerProvider> metaServerProviders = Lists.newArrayList(metaServerProviderIterator);
Collections.sort(metaServerProviders, new Comparator<MetaServerProvider>() {
@Override
public int compare(MetaServerProvider o1, MetaServerProvider o2) {
// the smaller order has higher priority
return Integer.compare(o1.getOrder(), o2.getOrder());
}
});
return metaServerProviders;
}
/**
* Select one available meta server from the comma separated meta server addresses, e.g.
* http://1.2.3.4:8080,http://2.3.4.5:8080
* <p>
* <br />
* <p>
* In production environment, we still suggest using one single domain like
* http://config.xxx.com(backed by software load balancers like nginx) instead of multiple ip
* addresses
*/
private static String selectMetaServerAddress(String metaServerAddresses) {
String metaAddressSelected = selectedMetaServerAddressCache.get(metaServerAddresses);
if (metaAddressSelected == null) {
// initialize
if (periodicRefreshStarted.compareAndSet(false, true)) {
schedulePeriodicRefresh();
}
updateMetaServerAddresses(metaServerAddresses);
metaAddressSelected = selectedMetaServerAddressCache.get(metaServerAddresses);
}
return metaAddressSelected;
}
private static void updateMetaServerAddresses(String metaServerAddresses) {
logger.debug("Selecting meta server address for: {}", metaServerAddresses);
Transaction transaction = Tracer
.newTransaction("Apollo.MetaService", "refreshMetaServerAddress");
transaction.addData("Url", metaServerAddresses);
try {
List<String> metaServers = Lists.newArrayList(metaServerAddresses.split(","));
// random load balancing
Collections.shuffle(metaServers);
boolean serverAvailable = false;
for (String address : metaServers) {
address = address.trim();
//check whether /services/config is accessible
if (NetUtil.pingUrl(address + "/services/config")) {
// select the first available meta server
selectedMetaServerAddressCache.put(metaServerAddresses, address);
serverAvailable = true;
logger.debug("Selected meta server address {} for {}", address, metaServerAddresses);
break;
}
}
// we need to make sure the map is not empty, e.g. the first update might be failed
if (!selectedMetaServerAddressCache.containsKey(metaServerAddresses)) {
selectedMetaServerAddressCache.put(metaServerAddresses, metaServers.get(0).trim());
}
if (!serverAvailable) {
logger.warn(
"Could not find available meta server for configured meta server addresses: {}, fallback to: {}",
metaServerAddresses, selectedMetaServerAddressCache.get(metaServerAddresses));
}
transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
throw ex;
} finally {
transaction.complete();
}
}
private static void schedulePeriodicRefresh() {
ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(1, ApolloThreadFactory.create("MetaServiceLocator", true));
scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
for (String metaServerAddresses : selectedMetaServerAddressCache.keySet()) {
updateMetaServerAddresses(metaServerAddresses);
}
} catch (Throwable ex) {
logger
.warn(String.format("Refreshing meta server address failed, will retry in %d seconds",
REFRESH_INTERVAL_IN_SECOND), ex);
}
}
}, REFRESH_INTERVAL_IN_SECOND, REFRESH_INTERVAL_IN_SECOND, TimeUnit.SECONDS);
}
}
| /*
* 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;
import com.ctrip.framework.apollo.core.enums.Env;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import com.ctrip.framework.apollo.core.utils.DeferredLoggerFactory;
import org.slf4j.Logger;
import com.ctrip.framework.apollo.core.spi.MetaServerProvider;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.core.utils.NetUtil;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.foundation.internals.ServiceBootstrap;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
/**
* The meta domain will try to load the meta server address from MetaServerProviders, the default
* ones are:
*
* <ul>
* <li>com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider</li>
* </ul>
* <p>
* If no provider could provide the meta server url, the default meta url will be used(http://apollo.meta).
* <br />
* <p>
* 3rd party MetaServerProvider could be injected by typical Java Service Loader pattern.
*
* @see com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider
*/
public class MetaDomainConsts {
public static final String DEFAULT_META_URL = "http://apollo.meta";
// env -> meta server address cache
private static final Map<Env, String> metaServerAddressCache = Maps.newConcurrentMap();
private static volatile List<MetaServerProvider> metaServerProviders = null;
private static final long REFRESH_INTERVAL_IN_SECOND = 60;// 1 min
private static final Logger logger = DeferredLoggerFactory.getLogger(MetaDomainConsts.class);
// comma separated meta server address -> selected single meta server address cache
private static final Map<String, String> selectedMetaServerAddressCache = Maps.newConcurrentMap();
private static final AtomicBoolean periodicRefreshStarted = new AtomicBoolean(false);
private static final Object LOCK = new Object();
/**
* Return one meta server address. If multiple meta server addresses are configured, will select
* one.
*/
public static String getDomain(Env env) {
String metaServerAddress = getMetaServerAddress(env);
// if there is more than one address, need to select one
if (metaServerAddress.contains(",")) {
return selectMetaServerAddress(metaServerAddress);
}
return metaServerAddress;
}
/**
* Return meta server address. If multiple meta server addresses are configured, will return the
* comma separated string.
*/
public static String getMetaServerAddress(Env env) {
if (!metaServerAddressCache.containsKey(env)) {
initMetaServerAddress(env);
}
return metaServerAddressCache.get(env);
}
private static void initMetaServerAddress(Env env) {
if (metaServerProviders == null) {
synchronized (LOCK) {
if (metaServerProviders == null) {
metaServerProviders = initMetaServerProviders();
}
}
}
String metaAddress = null;
for (MetaServerProvider provider : metaServerProviders) {
metaAddress = provider.getMetaServerAddress(env);
if (!Strings.isNullOrEmpty(metaAddress)) {
logger.info("Located meta server address {} for env {} from {}", metaAddress, env,
provider.getClass().getName());
break;
}
}
if (Strings.isNullOrEmpty(metaAddress)) {
// Fallback to default meta address
metaAddress = DEFAULT_META_URL;
logger.warn(
"Meta server address fallback to {} for env {}, because it is not available in all MetaServerProviders",
metaAddress, env);
}
metaServerAddressCache.put(env, metaAddress.trim());
}
private static List<MetaServerProvider> initMetaServerProviders() {
Iterator<MetaServerProvider> metaServerProviderIterator = ServiceBootstrap
.loadAll(MetaServerProvider.class);
List<MetaServerProvider> metaServerProviders = Lists.newArrayList(metaServerProviderIterator);
Collections.sort(metaServerProviders, new Comparator<MetaServerProvider>() {
@Override
public int compare(MetaServerProvider o1, MetaServerProvider o2) {
// the smaller order has higher priority
return Integer.compare(o1.getOrder(), o2.getOrder());
}
});
return metaServerProviders;
}
/**
* Select one available meta server from the comma separated meta server addresses, e.g.
* http://1.2.3.4:8080,http://2.3.4.5:8080
* <p>
* <br />
* <p>
* In production environment, we still suggest using one single domain like
* http://config.xxx.com(backed by software load balancers like nginx) instead of multiple ip
* addresses
*/
private static String selectMetaServerAddress(String metaServerAddresses) {
String metaAddressSelected = selectedMetaServerAddressCache.get(metaServerAddresses);
if (metaAddressSelected == null) {
// initialize
if (periodicRefreshStarted.compareAndSet(false, true)) {
schedulePeriodicRefresh();
}
updateMetaServerAddresses(metaServerAddresses);
metaAddressSelected = selectedMetaServerAddressCache.get(metaServerAddresses);
}
return metaAddressSelected;
}
private static void updateMetaServerAddresses(String metaServerAddresses) {
logger.debug("Selecting meta server address for: {}", metaServerAddresses);
Transaction transaction = Tracer
.newTransaction("Apollo.MetaService", "refreshMetaServerAddress");
transaction.addData("Url", metaServerAddresses);
try {
List<String> metaServers = Lists.newArrayList(metaServerAddresses.split(","));
// random load balancing
Collections.shuffle(metaServers);
boolean serverAvailable = false;
for (String address : metaServers) {
address = address.trim();
//check whether /services/config is accessible
if (NetUtil.pingUrl(address + "/services/config")) {
// select the first available meta server
selectedMetaServerAddressCache.put(metaServerAddresses, address);
serverAvailable = true;
logger.debug("Selected meta server address {} for {}", address, metaServerAddresses);
break;
}
}
// we need to make sure the map is not empty, e.g. the first update might be failed
if (!selectedMetaServerAddressCache.containsKey(metaServerAddresses)) {
selectedMetaServerAddressCache.put(metaServerAddresses, metaServers.get(0).trim());
}
if (!serverAvailable) {
logger.warn(
"Could not find available meta server for configured meta server addresses: {}, fallback to: {}",
metaServerAddresses, selectedMetaServerAddressCache.get(metaServerAddresses));
}
transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
throw ex;
} finally {
transaction.complete();
}
}
private static void schedulePeriodicRefresh() {
ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(1, ApolloThreadFactory.create("MetaServiceLocator", true));
scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
for (String metaServerAddresses : selectedMetaServerAddressCache.keySet()) {
updateMetaServerAddresses(metaServerAddresses);
}
} catch (Throwable ex) {
logger
.warn(String.format("Refreshing meta server address failed, will retry in %d seconds",
REFRESH_INTERVAL_IN_SECOND), ex);
}
}
}, REFRESH_INTERVAL_IN_SECOND, REFRESH_INTERVAL_IN_SECOND, TimeUnit.SECONDS);
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ApolloNotificationMessages.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;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import java.util.Map;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ApolloNotificationMessages {
private Map<String, Long> details;
public ApolloNotificationMessages() {
this(Maps.<String, Long>newHashMap());
}
private ApolloNotificationMessages(Map<String, Long> details) {
this.details = details;
}
public void put(String key, long notificationId) {
details.put(key, notificationId);
}
public Long get(String key) {
return this.details.get(key);
}
public boolean has(String key) {
return this.details.containsKey(key);
}
public boolean isEmpty() {
return this.details.isEmpty();
}
public Map<String, Long> getDetails() {
return details;
}
public void setDetails(Map<String, Long> details) {
this.details = details;
}
public void mergeFrom(ApolloNotificationMessages source) {
if (source == null) {
return;
}
for (Map.Entry<String, Long> entry : source.getDetails().entrySet()) {
//to make sure the notification id always grows bigger
if (this.has(entry.getKey()) &&
this.get(entry.getKey()) >= entry.getValue()) {
continue;
}
this.put(entry.getKey(), entry.getValue());
}
}
public ApolloNotificationMessages clone() {
return new ApolloNotificationMessages(ImmutableMap.copyOf(this.details));
}
}
| /*
* 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;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import java.util.Map;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ApolloNotificationMessages {
private Map<String, Long> details;
public ApolloNotificationMessages() {
this(Maps.<String, Long>newHashMap());
}
private ApolloNotificationMessages(Map<String, Long> details) {
this.details = details;
}
public void put(String key, long notificationId) {
details.put(key, notificationId);
}
public Long get(String key) {
return this.details.get(key);
}
public boolean has(String key) {
return this.details.containsKey(key);
}
public boolean isEmpty() {
return this.details.isEmpty();
}
public Map<String, Long> getDetails() {
return details;
}
public void setDetails(Map<String, Long> details) {
this.details = details;
}
public void mergeFrom(ApolloNotificationMessages source) {
if (source == null) {
return;
}
for (Map.Entry<String, Long> entry : source.getDetails().entrySet()) {
//to make sure the notification id always grows bigger
if (this.has(entry.getKey()) &&
this.get(entry.getKey()) >= entry.getValue()) {
continue;
}
this.put(entry.getKey(), entry.getValue());
}
}
public ApolloNotificationMessages clone() {
return new ApolloNotificationMessages(ImmutableMap.copyOf(this.details));
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./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"
* @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.
* @ApolloConfig("${redis.namespace:xxx}")
* private Config config;
* </pre>
*
*
* @author Jason Song(song_s@ctrip.com)
*/
@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"
* @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.
* @ApolloConfig("${redis.namespace:xxx}")
* private Config config;
* </pre>
*
*
* @author Jason Song(song_s@ctrip.com)
*/
@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,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-core/src/test/java/com/ctrip/framework/foundation/internals/provider/DefaultServerProviderTest.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.provider;
import static com.ctrip.framework.foundation.internals.provider.DefaultServerProvider.DEFAULT_SERVER_PROPERTIES_PATH_ON_LINUX;
import static com.ctrip.framework.foundation.internals.provider.DefaultServerProvider.DEFAULT_SERVER_PROPERTIES_PATH_ON_WINDOWS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import com.ctrip.framework.foundation.internals.Utils;
import java.io.File;
import java.io.FileInputStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.ctrip.framework.foundation.internals.provider.DefaultServerProvider;
public class DefaultServerProviderTest {
private DefaultServerProvider defaultServerProvider;
@Before
public void setUp() throws Exception {
cleanUp();
defaultServerProvider = new DefaultServerProvider();
}
@After
public void tearDown() throws Exception {
cleanUp();
}
private void cleanUp() {
System.clearProperty("env");
System.clearProperty("idc");
System.clearProperty("apollo.path.server.properties");
}
@Test
public void testGetServerPropertiesPathDefault() {
assertEquals(Utils.isOSWindows() ? DEFAULT_SERVER_PROPERTIES_PATH_ON_WINDOWS
: DEFAULT_SERVER_PROPERTIES_PATH_ON_LINUX, defaultServerProvider.getServerPropertiesPath());
}
@Test
public void testGetServerPropertiesPathCustom() {
final String customPath = "/simple/custom/path";
System.setProperty("apollo.path.server.properties", customPath);
assertEquals(customPath, defaultServerProvider.getServerPropertiesPath());
}
@Test
public void testEnvWithSystemProperty() throws Exception {
String someEnv = "someEnv";
String someDc = "someDc";
System.setProperty("env", someEnv);
System.setProperty("idc", someDc);
defaultServerProvider.initialize(null);
assertEquals(someEnv, defaultServerProvider.getEnvType());
assertEquals(someDc, defaultServerProvider.getDataCenter());
}
@Test
public void testWithPropertiesStream() throws Exception {
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
assertEquals("SHAJQ", defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals("DEV", defaultServerProvider.getEnvType());
}
@Test
public void testWithUTF8BomPropertiesStream() throws Exception {
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server-with-utf8bom.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
assertEquals("SHAJQ", defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals("DEV", defaultServerProvider.getEnvType());
}
@Test
public void testWithPropertiesStreamAndEnvFromSystemProperty() throws Exception {
String prodEnv = "pro";
System.setProperty("env", prodEnv);
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
String predefinedDataCenter = "SHAJQ";
assertEquals(predefinedDataCenter, defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals(prodEnv, defaultServerProvider.getEnvType());
}
@Test
public void testWithNoPropertiesStream() throws Exception {
defaultServerProvider.initialize(null);
assertNull(defaultServerProvider.getDataCenter());
assertFalse(defaultServerProvider.isEnvTypeSet());
assertNull(defaultServerProvider.getEnvType());
}
}
| /*
* 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.provider;
import static com.ctrip.framework.foundation.internals.provider.DefaultServerProvider.DEFAULT_SERVER_PROPERTIES_PATH_ON_LINUX;
import static com.ctrip.framework.foundation.internals.provider.DefaultServerProvider.DEFAULT_SERVER_PROPERTIES_PATH_ON_WINDOWS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import com.ctrip.framework.foundation.internals.Utils;
import java.io.File;
import java.io.FileInputStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.ctrip.framework.foundation.internals.provider.DefaultServerProvider;
public class DefaultServerProviderTest {
private DefaultServerProvider defaultServerProvider;
@Before
public void setUp() throws Exception {
cleanUp();
defaultServerProvider = new DefaultServerProvider();
}
@After
public void tearDown() throws Exception {
cleanUp();
}
private void cleanUp() {
System.clearProperty("env");
System.clearProperty("idc");
System.clearProperty("apollo.path.server.properties");
}
@Test
public void testGetServerPropertiesPathDefault() {
assertEquals(Utils.isOSWindows() ? DEFAULT_SERVER_PROPERTIES_PATH_ON_WINDOWS
: DEFAULT_SERVER_PROPERTIES_PATH_ON_LINUX, defaultServerProvider.getServerPropertiesPath());
}
@Test
public void testGetServerPropertiesPathCustom() {
final String customPath = "/simple/custom/path";
System.setProperty("apollo.path.server.properties", customPath);
assertEquals(customPath, defaultServerProvider.getServerPropertiesPath());
}
@Test
public void testEnvWithSystemProperty() throws Exception {
String someEnv = "someEnv";
String someDc = "someDc";
System.setProperty("env", someEnv);
System.setProperty("idc", someDc);
defaultServerProvider.initialize(null);
assertEquals(someEnv, defaultServerProvider.getEnvType());
assertEquals(someDc, defaultServerProvider.getDataCenter());
}
@Test
public void testWithPropertiesStream() throws Exception {
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
assertEquals("SHAJQ", defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals("DEV", defaultServerProvider.getEnvType());
}
@Test
public void testWithUTF8BomPropertiesStream() throws Exception {
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server-with-utf8bom.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
assertEquals("SHAJQ", defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals("DEV", defaultServerProvider.getEnvType());
}
@Test
public void testWithPropertiesStreamAndEnvFromSystemProperty() throws Exception {
String prodEnv = "pro";
System.setProperty("env", prodEnv);
File baseDir = new File("src/test/resources/properties");
File serverProperties = new File(baseDir, "server.properties");
defaultServerProvider.initialize(new FileInputStream(serverProperties));
String predefinedDataCenter = "SHAJQ";
assertEquals(predefinedDataCenter, defaultServerProvider.getDataCenter());
assertTrue(defaultServerProvider.isEnvTypeSet());
assertEquals(prodEnv, defaultServerProvider.getEnvType());
}
@Test
public void testWithNoPropertiesStream() throws Exception {
defaultServerProvider.initialize(null);
assertNull(defaultServerProvider.getDataCenter());
assertFalse(defaultServerProvider.isEnvTypeSet());
assertNull(defaultServerProvider.getEnvType());
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./scripts/helm/apollo-portal/values.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.
#
name: apollo-portal
fullNameOverride: ""
replicaCount: 1
containerPort: 8070
image:
repository: apolloconfig/apollo-portal
tag: ""
pullPolicy: IfNotPresent
imagePullSecrets: []
service:
fullNameOverride: ""
port: 8070
targetPort: 8070
type: ClusterIP
sessionAffinity: ClientIP
ingress:
enabled: false
annotations: {}
hosts:
- host: ""
paths: []
tls: []
liveness:
initialDelaySeconds: 100
periodSeconds: 10
readiness:
initialDelaySeconds: 30
periodSeconds: 5
# environment variables passed to the container, e.g. JAVA_OPTS
env: {}
strategy: {}
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
config:
# spring profiles to activate
profiles: "github,auth"
# specify the env names, e.g. dev,pro
envs: ""
# specify the meta servers, e.g.
# dev: http://apollo-configservice-dev:8080
# pro: http://apollo-configservice-pro:8080
metaServers: {}
# specify the context path, e.g. /apollo
contextPath: ""
# extra config files for apollo-portal, e.g. application-ldap.yml
files: {}
portaldb:
name: apollo-portaldb
# apolloportaldb host
host:
port: 3306
dbName: ApolloPortalDB
# apolloportaldb user name
userName:
# apolloportaldb password
password:
connectionStringProperties: characterEncoding=utf8
service:
# whether to create a Service for this host or not
enabled: false
fullNameOverride: ""
port: 3306
type: ClusterIP
| #
# 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.
#
name: apollo-portal
fullNameOverride: ""
replicaCount: 1
containerPort: 8070
image:
repository: apolloconfig/apollo-portal
tag: ""
pullPolicy: IfNotPresent
imagePullSecrets: []
service:
fullNameOverride: ""
port: 8070
targetPort: 8070
type: ClusterIP
sessionAffinity: ClientIP
ingress:
enabled: false
annotations: {}
hosts:
- host: ""
paths: []
tls: []
liveness:
initialDelaySeconds: 100
periodSeconds: 10
readiness:
initialDelaySeconds: 30
periodSeconds: 5
# environment variables passed to the container, e.g. JAVA_OPTS
env: {}
strategy: {}
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
config:
# spring profiles to activate
profiles: "github,auth"
# specify the env names, e.g. dev,pro
envs: ""
# specify the meta servers, e.g.
# dev: http://apollo-configservice-dev:8080
# pro: http://apollo-configservice-pro:8080
metaServers: {}
# specify the context path, e.g. /apollo
contextPath: ""
# extra config files for apollo-portal, e.g. application-ldap.yml
files: {}
portaldb:
name: apollo-portaldb
# apolloportaldb host
host:
port: 3306
dbName: ApolloPortalDB
# apolloportaldb user name
userName:
# apolloportaldb password
password:
connectionStringProperties: characterEncoding=utf8
service:
# whether to create a Service for this host or not
enabled: false
fullNameOverride: ""
port: 3306
type: ClusterIP
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./doc/images/apollo-net-server-url-config.png | PNG
IHDR F )!}
iCCPICC Profile HT[Lz$! ҫ@z *6D',"CbCA/CA]DEeX¾ݳgs͝o3? ~P
&3cb8 @es2n W}xdֿ_&dr fr>EP
"K8eEHn?='<a d6[ #gfs:d:f._'p>ҧT'/55$)ϼ˴La*{[igh!A|CYmJANϟf7b9e{ϲ8%m٢{YYJRXRN
D7ksxQ͏̔09ҼH*9Q-}Ǵ̹8ge}zM,wiMaj\>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lxƍ/ֱ<u8M'-=%>bkvb(4\*%32|իNX؈O(ED_a9h69y
P-aMτ]mhKP)tIG:(t:K-Q ;mQf,g5Ƙ%1Qf9KVچu`ƈ93̛㿳=~fi-l1Z!cWۂ 301u3s_ЍW!GrC]/x;̗>tx%ùk>]3`̀&zCv6f3`6À7j̀0f1ƨ!̀0f0p1 fN5f3`e`U_Xǚ~j{ΣxK}R6f3piѹolP
mbCAf\=df3`@U4FYS:ݲTrznڹ0flQ_S61qxSY:૱Q=tQ`vXm8ݳ0f2pƨ]cm Xd'Vf5hںZ5ne3`̀0[b?|͏vlZ@Ly`5ȕխ3?!ub]pSym̀0f6F(ݼimM5gcY>}f3`*~Q+~k|oHs5ķH.m㦈Lx6f3Pf?cK⍛sM f@jjsj?1#VĢ.CQf<N3`VXUcC8&@bbluC\k3f3vV%
MGl2c.e\
3`U5F823`̀U\30f3`0h[5f3`7FW}ޜ0f30э~s3`̀0@՚S~~(y
,YѶ&y:kg3`̀0@1Zv5=K}ϔu8p3`̀0@1ʚ6'!S6sֹ%Xv3`̀"ǨSmdF=uuC¸hW=c|)r2y18juh|,k3`̀0f` dF3{(Le]Ie@jS=%t9Ʊ<_;g3`̀g
S~`m;էTu|sjx|(c63`̀08j^k.&
LKsJ0G9.<ػ1̀0f@MzƁ
{8bk7Ed߹̀0fYހ9-MIɖvRhS{iQxku77kLAn90f3@nh,P(sÒ0f3hjbS̀0f3piuf3`%2OMd IENDB` | -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishEvent.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.listener;
import com.ctrip.framework.apollo.portal.environment.Env;
import org.springframework.context.ApplicationEvent;
public class ConfigPublishEvent extends ApplicationEvent {
private ConfigPublishInfo configPublishInfo;
public ConfigPublishEvent(Object source) {
super(source);
configPublishInfo = (ConfigPublishInfo) source;
}
public static ConfigPublishEvent instance() {
ConfigPublishInfo info = new ConfigPublishInfo();
return new ConfigPublishEvent(info);
}
public ConfigPublishInfo getConfigPublishInfo(){
return configPublishInfo;
}
public ConfigPublishEvent withAppId(String appId) {
configPublishInfo.setAppId(appId);
return this;
}
public ConfigPublishEvent withCluster(String clusterName) {
configPublishInfo.setClusterName(clusterName);
return this;
}
public ConfigPublishEvent withNamespace(String namespaceName) {
configPublishInfo.setNamespaceName(namespaceName);
return this;
}
public ConfigPublishEvent withReleaseId(long releaseId){
configPublishInfo.setReleaseId(releaseId);
return this;
}
public ConfigPublishEvent withPreviousReleaseId(long previousReleaseId){
configPublishInfo.setPreviousReleaseId(previousReleaseId);
return this;
}
public ConfigPublishEvent setNormalPublishEvent(boolean isNormalPublishEvent) {
configPublishInfo.setNormalPublishEvent(isNormalPublishEvent);
return this;
}
public ConfigPublishEvent setGrayPublishEvent(boolean isGrayPublishEvent) {
configPublishInfo.setGrayPublishEvent(isGrayPublishEvent);
return this;
}
public ConfigPublishEvent setRollbackEvent(boolean isRollbackEvent) {
configPublishInfo.setRollbackEvent(isRollbackEvent);
return this;
}
public ConfigPublishEvent setMergeEvent(boolean isMergeEvent) {
configPublishInfo.setMergeEvent(isMergeEvent);
return this;
}
public ConfigPublishEvent setEnv(Env env) {
configPublishInfo.setEnv(env);
return this;
}
public static class ConfigPublishInfo {
private String env;
private String appId;
private String clusterName;
private String namespaceName;
private long releaseId;
private long previousReleaseId;
private boolean isRollbackEvent;
private boolean isMergeEvent;
private boolean isNormalPublishEvent;
private boolean isGrayPublishEvent;
public Env getEnv() {
return Env.valueOf(env);
}
public void setEnv(Env env) {
this.env = env.toString();
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public long getReleaseId() {
return releaseId;
}
public void setReleaseId(long releaseId) {
this.releaseId = releaseId;
}
public long getPreviousReleaseId() {
return previousReleaseId;
}
public void setPreviousReleaseId(long previousReleaseId) {
this.previousReleaseId = previousReleaseId;
}
public boolean isRollbackEvent() {
return isRollbackEvent;
}
public void setRollbackEvent(boolean rollbackEvent) {
isRollbackEvent = rollbackEvent;
}
public boolean isMergeEvent() {
return isMergeEvent;
}
public void setMergeEvent(boolean mergeEvent) {
isMergeEvent = mergeEvent;
}
public boolean isNormalPublishEvent() {
return isNormalPublishEvent;
}
public void setNormalPublishEvent(boolean normalPublishEvent) {
isNormalPublishEvent = normalPublishEvent;
}
public boolean isGrayPublishEvent() {
return isGrayPublishEvent;
}
public void setGrayPublishEvent(boolean grayPublishEvent) {
isGrayPublishEvent = grayPublishEvent;
}
}
}
| /*
* 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.listener;
import com.ctrip.framework.apollo.portal.environment.Env;
import org.springframework.context.ApplicationEvent;
public class ConfigPublishEvent extends ApplicationEvent {
private ConfigPublishInfo configPublishInfo;
public ConfigPublishEvent(Object source) {
super(source);
configPublishInfo = (ConfigPublishInfo) source;
}
public static ConfigPublishEvent instance() {
ConfigPublishInfo info = new ConfigPublishInfo();
return new ConfigPublishEvent(info);
}
public ConfigPublishInfo getConfigPublishInfo(){
return configPublishInfo;
}
public ConfigPublishEvent withAppId(String appId) {
configPublishInfo.setAppId(appId);
return this;
}
public ConfigPublishEvent withCluster(String clusterName) {
configPublishInfo.setClusterName(clusterName);
return this;
}
public ConfigPublishEvent withNamespace(String namespaceName) {
configPublishInfo.setNamespaceName(namespaceName);
return this;
}
public ConfigPublishEvent withReleaseId(long releaseId){
configPublishInfo.setReleaseId(releaseId);
return this;
}
public ConfigPublishEvent withPreviousReleaseId(long previousReleaseId){
configPublishInfo.setPreviousReleaseId(previousReleaseId);
return this;
}
public ConfigPublishEvent setNormalPublishEvent(boolean isNormalPublishEvent) {
configPublishInfo.setNormalPublishEvent(isNormalPublishEvent);
return this;
}
public ConfigPublishEvent setGrayPublishEvent(boolean isGrayPublishEvent) {
configPublishInfo.setGrayPublishEvent(isGrayPublishEvent);
return this;
}
public ConfigPublishEvent setRollbackEvent(boolean isRollbackEvent) {
configPublishInfo.setRollbackEvent(isRollbackEvent);
return this;
}
public ConfigPublishEvent setMergeEvent(boolean isMergeEvent) {
configPublishInfo.setMergeEvent(isMergeEvent);
return this;
}
public ConfigPublishEvent setEnv(Env env) {
configPublishInfo.setEnv(env);
return this;
}
public static class ConfigPublishInfo {
private String env;
private String appId;
private String clusterName;
private String namespaceName;
private long releaseId;
private long previousReleaseId;
private boolean isRollbackEvent;
private boolean isMergeEvent;
private boolean isNormalPublishEvent;
private boolean isGrayPublishEvent;
public Env getEnv() {
return Env.valueOf(env);
}
public void setEnv(Env env) {
this.env = env.toString();
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public long getReleaseId() {
return releaseId;
}
public void setReleaseId(long releaseId) {
this.releaseId = releaseId;
}
public long getPreviousReleaseId() {
return previousReleaseId;
}
public void setPreviousReleaseId(long previousReleaseId) {
this.previousReleaseId = previousReleaseId;
}
public boolean isRollbackEvent() {
return isRollbackEvent;
}
public void setRollbackEvent(boolean rollbackEvent) {
isRollbackEvent = rollbackEvent;
}
public boolean isMergeEvent() {
return isMergeEvent;
}
public void setMergeEvent(boolean mergeEvent) {
isMergeEvent = mergeEvent;
}
public boolean isNormalPublishEvent() {
return isNormalPublishEvent;
}
public void setNormalPublishEvent(boolean normalPublishEvent) {
isNormalPublishEvent = normalPublishEvent;
}
public boolean isGrayPublishEvent() {
return isGrayPublishEvent;
}
public void setGrayPublishEvent(boolean grayPublishEvent) {
isGrayPublishEvent = grayPublishEvent;
}
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/NamespaceBO.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;
import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import java.util.List;
public class NamespaceBO {
private NamespaceDTO baseInfo;
private int itemModifiedCnt;
private List<ItemBO> items;
private String format;
private boolean isPublic;
private String parentAppId;
private String comment;
// is the configs hidden to current user?
private boolean isConfigHidden;
public NamespaceDTO getBaseInfo() {
return baseInfo;
}
public void setBaseInfo(NamespaceDTO baseInfo) {
this.baseInfo = baseInfo;
}
public int getItemModifiedCnt() {
return itemModifiedCnt;
}
public void setItemModifiedCnt(int itemModifiedCnt) {
this.itemModifiedCnt = itemModifiedCnt;
}
public List<ItemBO> getItems() {
return items;
}
public void setItems(List<ItemBO> items) {
this.items = items;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public String getParentAppId() {
return parentAppId;
}
public void setParentAppId(String parentAppId) {
this.parentAppId = parentAppId;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public boolean isConfigHidden() {
return isConfigHidden;
}
public void setConfigHidden(boolean hidden) {
isConfigHidden = hidden;
}
public void hideItems() {
setConfigHidden(true);
items.clear();
setItemModifiedCnt(0);
}
}
| /*
* 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;
import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import java.util.List;
public class NamespaceBO {
private NamespaceDTO baseInfo;
private int itemModifiedCnt;
private List<ItemBO> items;
private String format;
private boolean isPublic;
private String parentAppId;
private String comment;
// is the configs hidden to current user?
private boolean isConfigHidden;
public NamespaceDTO getBaseInfo() {
return baseInfo;
}
public void setBaseInfo(NamespaceDTO baseInfo) {
this.baseInfo = baseInfo;
}
public int getItemModifiedCnt() {
return itemModifiedCnt;
}
public void setItemModifiedCnt(int itemModifiedCnt) {
this.itemModifiedCnt = itemModifiedCnt;
}
public List<ItemBO> getItems() {
return items;
}
public void setItems(List<ItemBO> items) {
this.items = items;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public String getParentAppId() {
return parentAppId;
}
public void setParentAppId(String parentAppId) {
this.parentAppId = parentAppId;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public boolean isConfigHidden() {
return isConfigHidden;
}
public void setConfigHidden(boolean hidden) {
isConfigHidden = hidden;
}
public void hideItems() {
setConfigHidden(true);
items.clear();
setItemModifiedCnt(0);
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/ConfigFileControllerIntegrationTest.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.integration;
import com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCache;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.netflix.servo.util.Strings;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.jdbc.Sql;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegrationTest {
private String someAppId;
private String somePublicAppId;
private String someCluster;
private String someNamespace;
private String somePublicNamespace;
private String someDC;
private String someDefaultCluster;
private String grayClientIp;
private String nonGrayClientIp;
private static final Gson GSON = new Gson();
private ExecutorService executorService;
private Type mapResponseType = new TypeToken<Map<String, String>>(){}.getType();
@Autowired
private AppNamespaceServiceWithCache appNamespaceServiceWithCache;
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(appNamespaceServiceWithCache, "reset");
someDefaultCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
someAppId = "someAppId";
somePublicAppId = "somePublicAppId";
someCluster = "someCluster";
someNamespace = "someNamespace";
somePublicNamespace = "somePublicNamespace";
someDC = "someDC";
grayClientIp = "1.1.1.1";
nonGrayClientIp = "2.2.2.2";
executorService = Executors.newFixedThreadPool(1);
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsProperties() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k2=v2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsPropertiesWithGrayRelease() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, ConfigConsts.NAMESPACE_APPLICATION),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, nonGrayClientIp);
String result = response.getBody();
String anotherResult = anotherResponse.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=v1-gray"));
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertFalse(anotherResult.contains("k1=v1-gray"));
assertTrue(anotherResult.contains("k1=v1"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsProperties() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=override-someDC-v1"));
assertTrue(result.contains("k2=someDC-v2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsJson() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsJsonWithIncorrectCase() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace.toUpperCase());
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJson() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("override-someDC-v1", configs.get("k1"));
assertEquals("someDC-v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithIncorrectCase() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), someDC);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("override-someDC-v1", configs.get("k1"));
assertEquals("someDC-v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-default-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithGrayRelease() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(somePublicAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, somePublicNamespace),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, nonGrayClientIp);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
Map<String, String> anotherConfigs = GSON.fromJson(anotherResponse.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertEquals("override-v1", configs.get("k1"));
assertEquals("gray-v2", configs.get("k2"));
assertEquals("override-v1", anotherConfigs.get("k1"));
assertEquals("default-v2", anotherConfigs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-default-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithGrayReleaseAndIncorrectCase() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(somePublicAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, somePublicNamespace),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), nonGrayClientIp);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
Map<String, String> anotherConfigs = GSON.fromJson(anotherResponse.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertEquals("override-v1", configs.get("k1"));
assertEquals("gray-v2", configs.get("k2"));
assertEquals("override-v1", anotherConfigs.get("k1"));
assertEquals("default-v2", anotherConfigs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testConfigChanged() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k2=v2"));
String someReleaseName = "someReleaseName";
String someReleaseComment = "someReleaseComment";
Namespace namespace = new Namespace();
namespace.setAppId(someAppId);
namespace.setClusterName(someCluster);
namespace.setNamespaceName(someNamespace);
String someOwner = "someOwner";
Map<String, String> newConfigurations = ImmutableMap.of("k1", "v1-changed", "k2", "v2-changed");
buildRelease(someReleaseName, someReleaseComment, namespace, newConfigurations, someOwner);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
assertEquals(response.getBody(), anotherResponse.getBody());
List<String> keys = Lists.newArrayList(someAppId, someCluster, someNamespace);
String message = Strings.join(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR, keys.iterator());
sendReleaseMessage(message);
TimeUnit.MILLISECONDS.sleep(500);
ResponseEntity<String> newResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
result = newResponse.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=v1-changed"));
assertTrue(result.contains("k2=v2-changed"));
}
private String assembleKey(String appId, String cluster, String namespace) {
return Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR).join(appId, cluster, namespace);
}
}
| /*
* 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.integration;
import com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCache;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.netflix.servo.util.Strings;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.jdbc.Sql;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegrationTest {
private String someAppId;
private String somePublicAppId;
private String someCluster;
private String someNamespace;
private String somePublicNamespace;
private String someDC;
private String someDefaultCluster;
private String grayClientIp;
private String nonGrayClientIp;
private static final Gson GSON = new Gson();
private ExecutorService executorService;
private Type mapResponseType = new TypeToken<Map<String, String>>(){}.getType();
@Autowired
private AppNamespaceServiceWithCache appNamespaceServiceWithCache;
@Before
public void setUp() throws Exception {
ReflectionTestUtils.invokeMethod(appNamespaceServiceWithCache, "reset");
someDefaultCluster = ConfigConsts.CLUSTER_NAME_DEFAULT;
someAppId = "someAppId";
somePublicAppId = "somePublicAppId";
someCluster = "someCluster";
someNamespace = "someNamespace";
somePublicNamespace = "somePublicNamespace";
someDC = "someDC";
grayClientIp = "1.1.1.1";
nonGrayClientIp = "2.2.2.2";
executorService = Executors.newFixedThreadPool(1);
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsProperties() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k2=v2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsPropertiesWithGrayRelease() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, ConfigConsts.NAMESPACE_APPLICATION),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, nonGrayClientIp);
String result = response.getBody();
String anotherResult = anotherResponse.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=v1-gray"));
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertFalse(anotherResult.contains("k1=v1-gray"));
assertTrue(anotherResult.contains("k1=v1"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsProperties() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=override-someDC-v1"));
assertTrue(result.contains("k2=someDC-v2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsJson() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryConfigAsJsonWithIncorrectCase() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace.toUpperCase());
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJson() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("override-someDC-v1", configs.get("k1"));
assertEquals("someDC-v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-dc-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithIncorrectCase() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), someDC);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("override-someDC-v1", configs.get("k1"));
assertEquals("someDC-v2", configs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-default-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithGrayRelease() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(somePublicAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, somePublicNamespace),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, nonGrayClientIp);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
Map<String, String> anotherConfigs = GSON.fromJson(anotherResponse.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertEquals("override-v1", configs.get("k1"));
assertEquals("gray-v2", configs.get("k2"));
assertEquals("override-v1", anotherConfigs.get("k1"));
assertEquals("default-v2", anotherConfigs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-release-public-default-override.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/test-gray-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testQueryPublicConfigAsJsonWithGrayReleaseAndIncorrectCase() throws Exception {
AtomicBoolean stop = new AtomicBoolean();
periodicSendMessage(executorService, assembleKey(somePublicAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, somePublicNamespace),
stop);
TimeUnit.MILLISECONDS.sleep(500);
stop.set(true);
ResponseEntity<String> response =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), grayClientIp);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity(
"http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
String.class,
getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), nonGrayClientIp);
Map<String, String> configs = GSON.fromJson(response.getBody(), mapResponseType);
Map<String, String> anotherConfigs = GSON.fromJson(anotherResponse.getBody(), mapResponseType);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals(HttpStatus.OK, anotherResponse.getStatusCode());
assertEquals("override-v1", configs.get("k1"));
assertEquals("gray-v2", configs.get("k2"));
assertEquals("override-v1", anotherConfigs.get("k1"));
assertEquals("default-v2", anotherConfigs.get("k2"));
}
@Test
@Sql(scripts = "/integration-test/test-release.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testConfigChanged() throws Exception {
ResponseEntity<String> response =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
String result = response.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k2=v2"));
String someReleaseName = "someReleaseName";
String someReleaseComment = "someReleaseComment";
Namespace namespace = new Namespace();
namespace.setAppId(someAppId);
namespace.setClusterName(someCluster);
namespace.setNamespaceName(someNamespace);
String someOwner = "someOwner";
Map<String, String> newConfigurations = ImmutableMap.of("k1", "v1-changed", "k2", "v2-changed");
buildRelease(someReleaseName, someReleaseComment, namespace, newConfigurations, someOwner);
ResponseEntity<String> anotherResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
assertEquals(response.getBody(), anotherResponse.getBody());
List<String> keys = Lists.newArrayList(someAppId, someCluster, someNamespace);
String message = Strings.join(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR, keys.iterator());
sendReleaseMessage(message);
TimeUnit.MILLISECONDS.sleep(500);
ResponseEntity<String> newResponse =
restTemplate
.getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
getHostUrl(), someAppId, someCluster, someNamespace);
result = newResponse.getBody();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertTrue(result.contains("k1=v1-changed"));
assertTrue(result.contains("k2=v2-changed"));
}
private String assembleKey(String appId, String cluster, String namespace) {
return Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR).join(appId, cluster, namespace);
}
}
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./.git/refs/remotes/origin/HEAD | ref: refs/remotes/origin/master
| ref: refs/remotes/origin/master
| -1 |
apolloconfig/apollo | 3,804 | feature: add the delegating password encoder for apollo-portal simple auth | ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| vdiskg | 2021-07-02T11:16:09Z | 2021-07-10T08:12:21Z | 907dbad14e2d76bf1ffa3645d115534632e28cc2 | 72a04989d049e182dd409e2a76e5c0e4448a8a2d | feature: add the delegating password encoder for apollo-portal simple auth. ## What's the purpose of this PR
the best algorithm for password storage should change some day in the future. the `DelegatingPasswordEncoder` can makes the algorithm upgrade seamless.
## Brief changelog
1. extend the `ApolloPortalDB`.`Users`.`Password` to 512
2. replace the `BCryptPasswordEncoder` with the `DelegatingPasswordEncoder` backend of the `BCryptPasswordEncoder`
3. add a `PlaceholderPasswordEncoder` which return a random string as encoded password and never matches any encoded password.
4. replace the random string password for oidc with the `DelegatingPasswordEncoder` backend of the `PlaceholderPasswordEncoder`
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./doc/images/local-development/ConfigAdminApplication-VM-Options.png | PNG
IHDR \ i iCCPICC Profile HWXS[R -)7At{6B AŎ,*TDQTtUĶ@֊>QYYXPy}s3ɹ lFU }ILR7@
4ӉzGE(mh况$ֿWQD (S"N 59| Po4;?W VB q NaM N Rh_Y l0 % of'Qpp@`s!~Y+!6O.Nbdǰ,l[rţkAEKruۛ5+TFDBe>Wj/3Aqr~0 lPu f؞-B{4+ǩYh ;"Lgy/xWD16i`a
3bd< neń}fFKDl0h^
-]ψ
b<Qb(._qrn.hoInveFČv{5+ㆣ ?b8R, m
l& |