- Move proto files from api/center/ to api/common/ for auth, data, manager modules - Update java_package and java_outer_classname in moved proto files - Add GrpcDriverQuery message to shared query.proto in dc3-common-api - Move GrpcDriverQuery proto from common.driver to common package - Update Java imports referencing relocated proto messages - Remove redundant pom.xml metadata (developers, licenses, scm, version) from api submodules — inherited from parent Co-Authored-By: Claude <noreply@anthropic.com>
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
GetByCode- 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
GetById- Query user information by user IDGetByPrincipalId- 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)
permission.proto
Defines permission lookup RPC calls for RBAC.
Service: PermissionApi
ListPermissionCodes- List the permission codes granted to a principal
resource_registry.proto
Defines resource registry synchronization RPC calls.
Service: ResourceRegistryApi
Sync- Synchronize API/menu resource definitions into the registry
mcp_runtime.proto
Defines MCP (Model Context Protocol) runtime RPC calls for AI tool integration.
Service: McpRuntimeApi
Introspect- Introspect an MCP connectionListTools- List the tools exposed by an MCP connectionResolveTool- Resolve a tool definition by nameAuthorizeToolCall- Authorize an MCP tool invocationAudit- Record an MCP tool-call audit entry
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/center/auth/tenant.proto";
import "api/center/auth/token.proto";
import "api/center/auth/user.proto";
import "api/center/auth/local_credential.proto";
3. Implement Service
public class TenantServiceImpl extends TenantApiGrpc.TenantApiImplBase {
@Override
public void getByCode(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)