Commit Graph

108 Commits

Author SHA1 Message Date
hongye 006ffca559
fix(auth): add AI gRPC resource parser and enable auth for MCP/Agent requests (#13827)
Resolves #13824

This commit adds support for authentication of AI-related gRPC requests
(AbstractMcpRequest and AbstractAgentRequest) in the Nacos auth module.

Key changes:
- Implement AiGrpcResourceParser to extract namespace, group and resource name
  from AI protocol requests.
- Register AiGrpcResourceParser under SignType.AI in GrpcProtocolAuthService.
- Add comprehensive unit tests using parameterized testing to cover both
  MCP and Agent request types, including edge cases (null/empty fields).
- Fix missing security token refresh in AiGrpcClient by initializing
  SecurityProxy with scheduled login task.

Ensures that all incoming AI gRPC requests are properly authenticated
when security is enabled, closing a previous authorization gap.
2025-09-18 10:14:34 +08:00
杨翊 SionYang f1af11a50f
Add a2a api auth resource parser. (#13826) 2025-09-17 17:37:45 +08:00
icarus 7f0e9310fb
【Fix issue #13600】 auth error when non-admin users clone config (#13674)
* Fix #13600 auth error when non-admin users clone config

* Fix #13600 auth error when non-admin users clone config

* Fix #13600 auth error when non-admin users clone config

* Fix #13600 auth error when non-admin users clone config
2025-08-05 19:16:04 +08:00
杨翊 SionYang 4b325c5814
[ISSUE#13445] Change some data relation admin api to normal user access. (#13452)
Continuous Integration / ci (17, ubuntu-latest) (push) Has been cancelled Details
PUSH-CI / Build dist tar (push) Has been cancelled Details
PUSH-CI / Docker images (centos, 17) (push) Has been cancelled Details
PUSH-CI / Deploy nacos (push) Has been cancelled Details
PUSH-CI / Java e2e Test (push) Has been cancelled Details
PUSH-CI / GO E2E Test (push) Has been cancelled Details
PUSH-CI / Cpp E2E Test (push) Has been cancelled Details
PUSH-CI / Csharp E2E Test (push) Has been cancelled Details
PUSH-CI / Nodejs E2E Test (push) Has been cancelled Details
PUSH-CI / Python E2E Test (push) Has been cancelled Details
PUSH-CI / Clean (push) Has been cancelled Details
* Fix config admin api must request admin role problem.

* Fix naming admin api must request admin role problem.

* Fix unit test.
2025-05-30 14:05:38 +08:00
杨翊 SionYang 8bfa79f8d6
Upstream develop add ut (#13346)
* Add ut for distributed lock.

* Add ut for maintainer client module.

* For checkstyle.

* Try to fix ut.
2025-05-08 09:56:15 +08:00
杨翊 SionYang 3074951434
[ISSUE#13246] Add MCP(Model Context Protocol) Server And Support basic MCP(Model Context Protocol) operation console apis to Nacos. (#13247)
* Add AI MCP console api.

* Add AI MCP resource parser.

* Add mcp server console api inner implementation without tool operation.

* Add endpoint Specification for mcp api.

* Abstract some remote relative server spec into McpServerRemoteServiceConfig.

* Support handle mcp server tool.

* Support handle mcp server endpoint and fix some tools bug.
2025-04-14 11:41:14 +08:00
杨翊 SionYang c3b79cf15a
V3.0 develop auth plugin (#13215)
* Change auth plugin return boolean to AuthResult.

* set AuthContext result as AuthResult.

* Refactor to remove using AuthConfigs, replaced with NacosAuthConfig.

* Refactor to remove using AuthConfigs, replaced with NacosAuthConfig.

* Move AuthConfigs to default auth plugin impl module.
2025-03-31 16:10:01 +08:00
杨翊 SionYang cf691fa06c
Change some console api from public api to identity check only api. (#13208) 2025-03-26 14:34:30 +08:00
杨翊 SionYang 8bbcbbbbfe
V3.0 develop fix ut (#13167)
* Fix nacos client and relative depend ut.

* Fix nacos config ut.

* Fix nacos console ut.

* Fix nacos core ut.

* Fix nacos naming ut.

* Fix nacos default-auth-plugin-impl ut.

* Fix nacos prometheus ut.
2025-03-10 15:38:27 +08:00
杨翊 SionYang bcc298f2c6
Fix 3.0 cluster mode some problem. (#13158)
* Fix cluster mode deployment can't change the server port problem.

* Fix cluster mode can't get service subscribers in console.

* Fix cluster mode can't get config listener in console.
2025-03-07 10:02:49 +08:00
杨翊 SionYang 8de4e36d7e
Support nacos console deployment independent: PR 1 (#13072)
* Support start up with console only mode: step1 - basic start up.

* Support start up with console only mode: step2 - solve server state to fix console ui loading.
2025-01-24 17:53:53 +08:00
杨翊 SionYang 1775037721
Fix some 3.0 admin api problem. (#13049)
* Fix v3 admin api list instances problem.

* Fix admin api auth failed.
2025-01-17 11:42:37 +08:00
KomachiSion 87382160df Merge branch 'refs/heads/v3.0-develop' into summer-ospp#12028-sync-develop
# Conflicts:
#	auth/src/test/java/com/alibaba/nacos/auth/config/AuthConfigsTest.java
#	config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/ConfigOperationService.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpChangeConfigWorker.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpConfigHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/processor/DumpAllProcessor.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java
#	config/src/test/java/com/alibaba/nacos/config/server/controller/v2/ConfigControllerV2Test.java
#	console/pom.xml
#	console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java
#	core/src/main/java/com/alibaba/nacos/core/auth/AuthFilter.java
#	core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java
#	core/src/main/java/com/alibaba/nacos/core/listener/StartingApplicationListener.java
#	core/src/main/resources/META-INF/logback/nacos.xml
#	core/src/test/java/com/alibaba/nacos/core/auth/AuthFilterTest.java
#	core/src/test/java/com/alibaba/nacos/core/cluster/ServerMemberManagerTest.java
#	distribution/conf/nacos-logback.xml
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/NacosAuthManager.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/authenticate/AuthenticationManagerDelegator.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/filter/JwtAuthenticationTokenFilter.java
#	pom.xml
#	prometheus/src/main/java/com/alibaba/nacos/prometheus/conf/PrometheusSecurityConfiguration.java
2025-01-08 11:19:35 +08:00
Moritz Arena b16b90048a
Upgrade to SpringBoot 3 and support GraalVM packaging (#13020)
Upgrade to SpringBoot 3, JDK 17 and support GraalVM
2025-01-08 09:49:56 +08:00
杨翊 SionYang 05362b0b90
V3.0 develop starting listening enhance & fix console auth invalid problem. (#13001)
* Enhance StartingApplicationListener to reduce duplicate operation.

* Fix console auth invalid problem.
2024-12-30 17:51:49 +08:00
KomachiSion 6f3940735a Merge remote-tracking branch 'refs/remotes/upstream/develop' into v3.0-develop-sync-develop
# Conflicts:
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandler.java
#	config/src/test/java/com/alibaba/nacos/config/server/controller/v2/ConfigControllerV2Test.java
#	config/src/test/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandlerTest.java
#	console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js
#	console/src/main/resources/static/console-ui/public/js/main.js
#	console/src/main/resources/static/index.html
#	console/src/main/resources/static/js/main.js
2024-12-09 14:43:41 +08:00
杨翊 SionYang 6029ea4290
Use new nacos.io url replace older. (#12928) 2024-12-06 10:38:57 +08:00
杨翊 SionYang 255d269434
Fix unit test for v3.0. (#12896) 2024-11-26 15:06:51 +08:00
杨翊 SionYang f947cc83a1
Support grpc inner api force check server identity info. (#12886) 2024-11-22 11:19:24 +08:00
KomachiSion dccecd3b76 Merge remote-tracking branch 'refs/remotes/upstream/develop' into v3.0-develop-sync-develop
# Conflicts:
#	console/src/main/resources/application.properties
#	core/src/main/java/com/alibaba/nacos/core/auth/AuthFilter.java
2024-11-21 15:19:08 +08:00
杨翊 SionYang 4be615cef4
Refactor Auth server identity check. (#12871)
* Refactor Auth server identity check.

* Fix Unit test.

* For checkstyle.
2024-11-21 14:05:50 +08:00
杨翊 SionYang d75b1a2a9a
[Refactor] Deprecated old api and default disabled old console api. (#12830)
* Add old API Compatibility annotation logic and control namespace api.

* Add Compatibility annotation for old console module API.

* Add Compatibility annotation for old core module API.

* Add Compatibility annotation for old naming module API.

* Add Compatibility annotation for old config module API.

* Add Compatibility annotation for old default auth plugin module API.

* Add api compatibility configuration to application.properties.

* Add unit test for compatibility.
2024-11-07 10:34:57 +08:00
张煜坤 7b3fe68ab4 Merge remote-tracking branch 'upstream/develop' into develop-issue#12017-ui-fix
# Conflicts:
#	console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js
#	console-ui/src/reducers/authority.js
2024-10-28 19:52:34 +08:00
杨翊 SionYang 2b178bec38
Refactor update password api auth check and add unit test. (#12757) 2024-10-17 16:32:59 +08:00
张煜坤 59858d1ebe
[ISSUE #12017] Split console authentication (#12474)
* [ISSUE #12017] Git Test

* Git Test

* [ISSUE #12017] Fix Git Test

* Fix Git Test

* [ISSUE #12017] Splitting server and console authentication

* Add ApiType annotations

* Update configuration file to add fields

* Update console authentication status fetch

* Update `application.properties` - Reuse `nacos.core.auth.enabled` and add `nacos.core.auth.console.enabled`

* Update `AuthConfigs` - Modify `isAuthEnabled()` to manage plugin initialization

* Update `AbstractProtocolAuthService` - Implement `isAuthEnabled()` method for `Secured` annotation and configuration-based authentication

* Update `RemoteRequestAuthFilter` - Use `authConfigs.isAuthEnabled()` for initialization and `protocolAuthService.authEnabled(secured)` for authentication checks

* [ISSUE #12017] Update the location of the authentication judgment

* Update the location of the authentication judgment
2024-08-27 15:59:37 +08:00
张煜坤 95e9a22f2c
[ISSUE #12017] Add console backend configuration handling (#12420)
* 提交测试

* [ISSUE #12017] Add console backend configuration handling with proxy and handler layers

* Add ConfigHandler interface for defining configuration operations

* Add ConfigInnerHandler to handle internal configuration logic

* Add ConfigProxy to delegate configuration tasks based on deployment type

* Add ConfigController to utilize ConfigProxy for configuration operations

* Update ConsoleConfig to get development type

* [ISSUE #12017] Fix checkstyle format

* Fix checkstyle format

* Add configuration file fields

* [ISSUE #12017] Update ConsoleConfigController route

* Update ConsoleConfigController route

* [ISSUE #12017] Fix CI PMD violation

* Delete unnecessary comments

* [ISSUE #12017] Update ConsoleConfigController return format

* Update ConsoleConfigController return format

* [ISSUE #12017] Update ConsoleConfigController publishConfig

* Update ConsoleConfigController publishConfig

* [ISSUE #12017] Updated the backend of the console's config section

* Added parameter validation and return value encapsulation to the Controller section

* Put business operations into the handler layer

* A total of 9 APIs are involved in the config section.

* [ISSUE #12017] Updating the config section backend methods

* Updating the config section backend methods

* [ISSUE #12017] Add unit tests for the config section

* Add unit tests for the config section

* Update uri of query method

* [ISSUE #12017] Delete redundant error codes

* Delete redundant error codes

---------

Co-authored-by: rickonzhang <2239164929@qq.com>
2024-08-21 13:53:08 +08:00
blake.qiu 1879c81edd
fix(#12333): fixed auth Plugin resource parser can't parser v2 config openAPI namespaceId. (#12336)
fix(#12333): fixed auth Plugin resource parser can't parser v2 config openAPI namespaceId.
2024-07-18 11:17:42 +08:00
hth e8e8cd29c0
add some UT for default auth plugin (#12318) 2024-07-08 10:48:51 +08:00
shalk(xiao kun) 8034da88e5
[ISSUE #12016] upgrade to junit5 and remove junit4 (#12280)
* clean junit4

* clean junit4

* clean some test dep; fix scope

* fix test compile
2024-06-26 17:39:08 +08:00
hth 992f10a1d6
[ISSUE #11957] AuthModule add admin exist (#12066)
* AuthModule add admin exist

* test fix

* fix state

* add state cache

* rename to auth_admin_request

* test fix

* auth_admin_request default value fix

* fix admin request
2024-05-24 10:14:40 +08:00
shalk(xiao kun) dc0e46e9f9
upgrade module naocs-auth from junit4 to junit5 (#12105) 2024-05-16 09:41:05 +08:00
hth 70ad2eb991
[ISSUE #11957] Remove default password (#11991)
* Remove default password

* admin role check fix

* remove tmp admin
2024-04-29 10:04:00 +08:00
zhanghong 8f1cb59370
[ISSUE #11782] Optimized the use of map (#11783)
* Optimized the use of map

* Optimized the use of map
2024-03-01 10:05:33 +08:00
hth 9722ad8dd5
Auth check fix (#11672) 2024-01-19 15:24:18 +08:00
杨翊 SionYang f5d72a3455
Revert "[ISSUES #11601]Auth check fix" (#11671) 2024-01-17 16:10:23 +08:00
hth 51fa941df7
Auth check fix (#11649) 2024-01-17 16:07:55 +08:00
阿魁 d85e3f7f31
[ISSUE #11231]Optimize the handleSpringBinder method in PropertiesUtil. (#11240) 2023-10-11 09:23:31 +08:00
Sunrisea ba8e0e2dff
[ISSUE #10734] Implemented the parameter validation utility class (#10737)
* For #10734,Refactor the AbstractConfigRequest ,move common properties from its subclasses to the parent class,to reduce the number of corresponding parameter extractors by .

* For #10734,add ParamCheckRules,ParamCheckUtils, add  ParamExtractor interface and the abstract classes HttpParamExtractor and RpcParamExtractor, implement the corresponding Manager.

* For #10734,fix codestyle

* For #10734,fix codestyle , move extractor and extractorManager to core directory

* For #10734,fix codestyle

* For #10734,fix dependency of common module

* For #10734,fix codestyle and copyright

* For #10734,fix pom codestyle and copyright

* For #10734,fix pom codestyle and copyright

* For #10734,fix  copyright

* For #10734,fix  copyright

* For #10734,fix bug caused by refactor of AbstractConfigRequest ,add ut test of ParamExtractorManager

* For #10734,fix bug caused by refactor of AbstractConfigRequest

---------

Co-authored-by: zhuoguang <sunrisea@B-Q6UQMD6R-0222.local>
2023-07-07 11:06:00 +08:00
杨翊 SionYang 5fffde5bde
[ISSUE#10153] Add auth state into /state api and add announcement api. (#10203)
* Add ModuleState and use ModuleState replace ServerStateController.

* Add AuthModuleStateBuilder

* state接口使用ModuleState.

* Add announcement api.

* skip rat scan for announcement.conf

* default plugin open login page when auth.enabled=true.
2023-03-27 19:00:22 +08:00
杨翊 SionYang cdd2be65af
Remove identity default value. (#10108) 2023-03-16 11:08:33 +08:00
WangLiang/王良 a397c10a54
Optimize the `nacos-client/pom.xml` for exclude `google/**/*.proto` (#9982)
* Optimize the pom.xml of the nacos-client

* optimize pom

* exclude `google/**/*.proto`

* tab

* Remove dependency `io.grpc:protoc-gen-grpc-java:${version}:pom`

* revert indent

* revert native-image
2023-03-01 09:42:15 +08:00
gongzhongqiang 708387c277
fix:replace nacos website url to https. (#9797) 2023-01-10 09:47:52 +08:00
陈浩 Nineteen 76df11bc48
fix comment (#9695) 2022-12-13 09:20:12 +08:00
Karson cfa3a0fd59
Unfiy Map's get and put methods by computeIfAbsent In AuthConfig (#8390)
* Unfiy Map's get and put methods by computeIfAbsent In AuthConfig

reformat code style

reformat code style

* reformat code style

* reformat issue
2022-05-23 15:19:22 +08:00
KomachiSion 7623bb82b2 Add requestClass to resource properties for grpc resource parser. 2022-03-23 11:47:54 +08:00
杨翊 SionYang 47506c57ab
[ISSUE#5696] Secured annotation add tags field. (#7878)
* Add tags in Secured and inject tags into resource properties.

* For checkstyle.
2022-03-03 15:20:27 +08:00
KomachiSion 5931ded303 Remove unused mock in unit test. 2022-02-15 14:29:41 +08:00
KomachiSion eeb5268282 auth plugin add enableAuth method to switch auth more precisely. 2022-02-15 14:21:31 +08:00
杨翊 SionYang 1c3656a1b0
[ISSUE#5696] Keep original resource parse result rather than use any replace when … (#7764)
* Keep original resource parse result rathar than use any replace when resource is empty.

* Identity Builder for http will be case-insensitive.

* For checkstyle.
2022-02-15 10:21:55 +08:00
杨翊 SionYang 64dcc0ed0a
[ISSUE#5696] IdentityContext build from resource and remote ip. (#7745)
* validateIdentity add Resource input for extension.

* IdentityContext parse remoteIp.
2022-02-09 17:57:39 +08:00