refactor: extract authentication system to auth package
- Create auth/jwt.go with JWT token management - Create auth/permissions.go with permission checking logic - Create auth/storage.go with storage key utilities - Create auth/auth.go with main authentication service - Create auth/middleware.go with auth and rate limit middleware - Update main.go to import auth package and use auth.* functions - Add authService to Server struct Major auth functionality now separated into dedicated package. Build tested and verified working. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
auth/storage.go
Normal file
19
auth/storage.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package auth
|
||||
|
||||
// Storage key generation utilities for authentication data
|
||||
|
||||
func UserStorageKey(userUUID string) string {
|
||||
return "user:" + userUUID
|
||||
}
|
||||
|
||||
func GroupStorageKey(groupUUID string) string {
|
||||
return "group:" + groupUUID
|
||||
}
|
||||
|
||||
func TokenStorageKey(tokenHash string) string {
|
||||
return "token:" + tokenHash
|
||||
}
|
||||
|
||||
func ResourceMetadataKey(resourceKey string) string {
|
||||
return resourceKey + ":metadata"
|
||||
}
|
Reference in New Issue
Block a user