forked from baron/baron-sso
클라이언트 생성일 표시 기능 추가
This commit is contained in:
@@ -306,6 +306,7 @@ func (h *DevHandler) CreateClient(c *fiber.Ctx) error {
|
||||
metadata = map[string]interface{}{}
|
||||
}
|
||||
metadata["status"] = status
|
||||
metadata["created_at"] = time.Now().Format(time.RFC3339)
|
||||
|
||||
tokenAuthMethod := strings.TrimSpace(valueOr(req.TokenEndpointAuthMethod, ""))
|
||||
if tokenAuthMethod == "" {
|
||||
@@ -683,10 +684,17 @@ func generateRandomSecret(length int) (string, error) {
|
||||
|
||||
func (h *DevHandler) mapClientSummary(client domain.HydraClient) clientSummary {
|
||||
status := "active"
|
||||
var createdAt *time.Time
|
||||
|
||||
if client.Metadata != nil {
|
||||
if value, ok := client.Metadata["status"].(string); ok && strings.ToLower(value) == "inactive" {
|
||||
status = "inactive"
|
||||
}
|
||||
if value, ok := client.Metadata["created_at"].(string); ok {
|
||||
if t, err := time.Parse(time.RFC3339, value); err == nil {
|
||||
createdAt = &t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clientType := "private"
|
||||
@@ -732,6 +740,7 @@ func (h *DevHandler) mapClientSummary(client domain.HydraClient) clientSummary {
|
||||
Name: name,
|
||||
Type: clientType,
|
||||
Status: status,
|
||||
CreatedAt: createdAt,
|
||||
RedirectURIs: client.RedirectURIs,
|
||||
Scopes: scopes,
|
||||
ClientSecret: clientSecret,
|
||||
|
||||
Reference in New Issue
Block a user