-
This commit is contained in:
@ -42,6 +42,14 @@ func (s *applicationService) Create(ctx context.Context, req *domain.CreateAppli
|
||||
return nil, fmt.Errorf("validation failed: %w", err)
|
||||
}
|
||||
|
||||
// Manual validation for Duration fields
|
||||
if req.TokenRenewalDuration.Duration <= 0 {
|
||||
return nil, fmt.Errorf("token_renewal_duration must be greater than 0")
|
||||
}
|
||||
if req.MaxTokenDuration.Duration <= 0 {
|
||||
return nil, fmt.Errorf("max_token_duration must be greater than 0")
|
||||
}
|
||||
|
||||
// Basic permission validation - check if user can create applications
|
||||
// In a real system, this would check against user roles/permissions
|
||||
if userID == "" {
|
||||
@ -127,6 +135,14 @@ func (s *applicationService) Update(ctx context.Context, appID string, updates *
|
||||
return nil, fmt.Errorf("user authentication required")
|
||||
}
|
||||
|
||||
// Manual validation for Duration fields
|
||||
if updates.TokenRenewalDuration != nil && updates.TokenRenewalDuration.Duration <= 0 {
|
||||
return nil, fmt.Errorf("token_renewal_duration must be greater than 0")
|
||||
}
|
||||
if updates.MaxTokenDuration != nil && updates.MaxTokenDuration.Duration <= 0 {
|
||||
return nil, fmt.Errorf("max_token_duration must be greater than 0")
|
||||
}
|
||||
|
||||
// Additional business logic validation
|
||||
if updates.TokenRenewalDuration != nil && updates.MaxTokenDuration != nil {
|
||||
if updates.TokenRenewalDuration.Duration > updates.MaxTokenDuration.Duration {
|
||||
|
||||
Reference in New Issue
Block a user