Tool authorization (HIGH-risk confirmation): - add AuthorizeToolCall RPC; the gateway calls it before tool execution - sign/consume confirmation tickets with idempotency-key dedup - propagate x-dc3-ai metadata (riskLevel/destructive/openWorld/idempotent) from the scan through the registry to the tool catalog OAuth hardening: - rotate refresh tokens and revoke the authorization on replay via previous_refresh_token_hash Password lifecycle: - require password change on login when flagged or expired (R20303/R20304) - expose a public POST /token/change_password endpoint OpenAPI aggregation: - switch McpOpenApiAggregator to classpath static snapshots, dropping the runtime fetch and McpAggregatorProperties
DC3 API Auth
Overview
dc3-api-auth provides gRPC service definitions for authentication and authorization in the IoT DC3 platform. It
defines the interfaces for tenant management, user authentication,
token validation, and local credential lookup.
Module Information
- Group ID: io.github.pnoker
- Artifact ID: dc3-api-auth
- Version: 2026.5.22
- Package:
io.github.pnoker.api.center.auth
Proto Definitions
tenant.proto
Defines tenant-related RPC calls and data structures.
Service: TenantApi
SelectByCode- Query tenant information by tenant code
Key Messages:
GrpcCodeQuery- Request wrapper for tenant code queriesGrpcRTenantDTO- Response wrapper containing tenant informationGrpcTenantDTO- Tenant data structure (name, code, enable flag)
token.proto
Defines token validation RPC calls and data structures.
Service: TokenApi
CheckValid- Validate authentication tokens
Key Messages:
GrpcLoginQuery- Request wrapper with login credentials (tenant, name, password, token)GrpcRTokenDTO- Response wrapper with validation result
user.proto
Defines user-related RPC calls and data structures.
Service: UserApi
SelectById- Query user information by user IDSelectByPrincipalId- Query user information by principal ID
Key Messages:
GrpcIdQuery- Request wrapper for user ID queriesGrpcRUserDTO- Response wrapper containing user informationGrpcUserDTO- User data structure (nickname, username, phone, email)
local_credential.proto
Defines local credential lookup RPC calls and data structures.
Service: LocalCredentialApi
GetByLoginName- Query local credential information by login name
Key Messages:
GrpcLoginNameQuery- Request wrapper for login-name queriesGrpcRLocalCredentialDTO- Response wrapper containing local credential informationGrpcLocalCredentialDTO- Local credential data structure (login name, principal ID)
Dependencies
This module depends on common proto definitions:
api/common/base.proto- Base entity fields (ID, timestamps)api/common/r.proto- Common response wrapper
Usage
1. Add Dependency
<dependency>
<groupId>io.github.pnoker</groupId>
<artifactId>dc3-api-auth</artifactId>
<version>2026.5.22</version>
</dependency>
2. Import Proto Files
import "api/common/auth/tenant.proto";
import "api/common/auth/token.proto";
import "api/common/auth/user.proto";
import "api/common/auth/local_credential.proto";
3. Implement Service
public class TenantServiceImpl extends TenantApiGrpc.TenantApiImplBase {
@Override
public void selectByCode(GrpcCodeQuery request,
StreamObserver<GrpcRTenantDTO> responseObserver) {
// Implementation
}
}
API Features
Multi-Tenancy Support
- Tenant isolation through tenant codes
- Tenant-scoped user management
- Cross-tenant operations support
Authentication Flow
- Client queries tenant by code
- Local credential lookup via
LocalCredentialApi - Token validation via
TokenApi - User information retrieval by principal via
UserApi
Security Features
- Server-side password hashing
- Token-based authentication
- User credential management
- Login tracking with principal IDs
Data Models
Tenant Model
- tenant_name: Display name of the tenant
- tenant_code: Unique tenant identifier
- enable_flag: Active/inactive status (1=enabled, 0=disabled)
User Model
- nick_name: Display name
- user_name: Unique username
- phone: Contact phone number
- email: Email address
- social_ext: Encrypted social account information
- identity_ext: Encrypted identity verification data
Login Lookup Model
- login_name: Username for authentication
- user_id: Reference to user entity
- principal_id: Reference to unified auth principal
- enable_flag: Account status
Build Instructions
# Build the module
mvn -s ../../.mvn/settings.xml clean package
# Install to local repository
mvn -s ../../.mvn/settings.xml clean install
License
Copyright 2016-present the IoT DC3 original author or authors.
Licensed under the GNU Affero General Public License v3.0 (AGPL 3.0)