Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature:added permission configuration support for nacos 1.2 #2367

Merged
merged 16 commits into from Mar 19, 2020

Conversation

funky-eyes
Copy link
Contributor

Ⅰ. Describe what this PR did

added permission configuration support for nacos 1.2

Ⅱ. Does this pull request fix one issue?

#2365

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Mar 6, 2020

Codecov Report

Merging #2367 into develop will decrease coverage by 0.03%.
The diff coverage is 25.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2367      +/-   ##
=============================================
- Coverage      51.78%   51.75%   -0.04%     
+ Complexity      2697     2696       -1     
=============================================
  Files            517      517              
  Lines          16772    16788      +16     
  Branches        2030     2030              
=============================================
+ Hits            8685     8688       +3     
- Misses          7277     7289      +12     
- Partials         810      811       +1     
Impacted Files Coverage Δ Complexity Δ
...ure/properties/registry/ConfigNacosProperties.java 38.09% <25.00%> (-8.06%) 3.00 <0.00> (ø)
...e/properties/registry/RegistryNacosProperties.java 42.85% <25.00%> (-10.99%) 4.00 <0.00> (ø)
...in/java/io/seata/server/session/GlobalSession.java 84.00% <0.00%> (-0.45%) 72.00% <0.00%> (-1.00%)

@@ -191,6 +194,17 @@ private static Properties getConfigProperties() {
}
properties.setProperty(PRO_NAMESPACE_KEY, namespace);
}
if (StringUtils.isNotBlank(System.getProperty(USER_NAME))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to write like this:

String userName = StringUtils.isNotBlank(System.getProperty(USER_NAME))
            ? System.getProperty(USER_NAME)
            : FILE_CONFIG.getConfig(getNacosUserName());
        String password = StringUtils.isNotBlank(System.getProperty(PASSWORD))
            ? System.getProperty(PASSWORD)
            : FILE_CONFIG.getConfig(getNacosPassword());
        if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)) {
            properties.setProperty(USER_NAME, userName);
            properties.setProperty(PASSWORD, password);
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to write like this:

String userName = StringUtils.isNotBlank(System.getProperty(USER_NAME))
            ? System.getProperty(USER_NAME)
            : FILE_CONFIG.getConfig(getNacosUserName());
        String password = StringUtils.isNotBlank(System.getProperty(PASSWORD))
            ? System.getProperty(PASSWORD)
            : FILE_CONFIG.getConfig(getNacosPassword());
        if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)) {
            properties.setProperty(USER_NAME, userName);
            properties.setProperty(PASSWORD, password);
        }

thx,i under reference

Copy link
Contributor

@objcoding objcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does registry conf also need permission?

@funky-eyes
Copy link
Contributor Author

Does registry conf also need permission?

@objcoding nacos1.2 auth only configuration centers are supported

@objcoding
Copy link
Contributor

Does registry conf also need permission?

@objcoding nacos1.2 auth only configuration centers are supported

ok, now I know.

Copy link
Contributor Author

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@objcoding PTAL

@@ -191,6 +194,17 @@ private static Properties getConfigProperties() {
}
properties.setProperty(PRO_NAMESPACE_KEY, namespace);
}
if (StringUtils.isNotBlank(System.getProperty(USER_NAME))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to write like this:

String userName = StringUtils.isNotBlank(System.getProperty(USER_NAME))
            ? System.getProperty(USER_NAME)
            : FILE_CONFIG.getConfig(getNacosUserName());
        String password = StringUtils.isNotBlank(System.getProperty(PASSWORD))
            ? System.getProperty(PASSWORD)
            : FILE_CONFIG.getConfig(getNacosPassword());
        if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)) {
            properties.setProperty(USER_NAME, userName);
            properties.setProperty(PASSWORD, password);
        }

thx,i under reference

@funky-eyes
Copy link
Contributor Author

Does registry conf also need permission?

@objcoding nacos1.2 auth only configuration centers are supported

ok, now I know.

my fault, registry support

@funky-eyes
Copy link
Contributor Author

Does registry conf also need permission?

@objcoding nacos1.2 auth only configuration centers are supported

ok, now I know.

@objcoding @zjinlei @slievrly @xingfudeshi PTAL

@zjinlei zjinlei added this to the 1.2.0 milestone Mar 12, 2020
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@objcoding objcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xingfudeshi
Copy link
Member

LGTM.

@xingfudeshi xingfudeshi merged commit 6ddcf27 into apache:develop Mar 19, 2020
@purgeyao
Copy link

  nacos {
    application = "seata-server"
    serverAddr = "10.1.1.97"
    namespace = "14ec3d04-0aab-4286-b7e1-8193f5dcb4ff"
    cluster = "default"
    username = "nacos"
    password = "nacos"
  }

配置了密码账号还是403 什么情况 还有其他配置么seata1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants