forked from baron/baron-sso
RedirectURI 기반 Fallback 로직 추가
This commit is contained in:
@@ -3184,6 +3184,7 @@ type linkedRpSummary struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Logo string `json:"logo,omitempty"`
|
Logo string `json:"logo,omitempty"`
|
||||||
|
URL string `json:"url,omitempty"` // Added
|
||||||
LastAuthenticatedAt string `json:"lastAuthenticatedAt,omitempty"`
|
LastAuthenticatedAt string `json:"lastAuthenticatedAt,omitempty"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Scopes []string `json:"scopes,omitempty"`
|
Scopes []string `json:"scopes,omitempty"`
|
||||||
@@ -3246,6 +3247,14 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
|||||||
name = clientID
|
name = clientID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClientURI가 없으면 RedirectURIs에서 호스트 부분만 추출하여 URL로 사용 (Fallback)
|
||||||
|
clientURL := strings.TrimSpace(client.ClientURI)
|
||||||
|
if clientURL == "" && len(client.RedirectURIs) > 0 {
|
||||||
|
if parsed, err := url.Parse(client.RedirectURIs[0]); err == nil {
|
||||||
|
clientURL = fmt.Sprintf("%s://%s", parsed.Scheme, parsed.Host)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lastAuth := time.Time{}
|
lastAuth := time.Time{}
|
||||||
if session.AuthenticatedAt != nil {
|
if session.AuthenticatedAt != nil {
|
||||||
lastAuth = *session.AuthenticatedAt
|
lastAuth = *session.AuthenticatedAt
|
||||||
@@ -3267,6 +3276,7 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
|||||||
ID: clientID,
|
ID: clientID,
|
||||||
Name: name,
|
Name: name,
|
||||||
Logo: extractHydraClientLogo(client.Metadata),
|
Logo: extractHydraClientLogo(client.Metadata),
|
||||||
|
URL: clientURL,
|
||||||
Status: hydraClientStatus(client.Metadata),
|
Status: hydraClientStatus(client.Metadata),
|
||||||
Scopes: scopes,
|
Scopes: scopes,
|
||||||
},
|
},
|
||||||
@@ -3281,6 +3291,9 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
|||||||
if existing.Logo == "" {
|
if existing.Logo == "" {
|
||||||
existing.Logo = extractHydraClientLogo(client.Metadata)
|
existing.Logo = extractHydraClientLogo(client.Metadata)
|
||||||
}
|
}
|
||||||
|
if existing.URL == "" {
|
||||||
|
existing.URL = clientURL
|
||||||
|
}
|
||||||
existing.Scopes = mergeScopes(existing.Scopes, scopes)
|
existing.Scopes = mergeScopes(existing.Scopes, scopes)
|
||||||
if lastAuth.After(existing.lastAuth) {
|
if lastAuth.After(existing.lastAuth) {
|
||||||
existing.lastAuth = lastAuth
|
existing.lastAuth = lastAuth
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ type HydraAdminService struct {
|
|||||||
type HydraClient struct {
|
type HydraClient struct {
|
||||||
ClientID string `json:"client_id"`
|
ClientID string `json:"client_id"`
|
||||||
ClientName string `json:"client_name,omitempty"`
|
ClientName string `json:"client_name,omitempty"`
|
||||||
ClientSecret string `json:"client_secret,omitempty"` // Added
|
ClientSecret string `json:"client_secret,omitempty"`
|
||||||
|
ClientURI string `json:"client_uri,omitempty"` // Added
|
||||||
RedirectURIs []string `json:"redirect_uris,omitempty"`
|
RedirectURIs []string `json:"redirect_uris,omitempty"`
|
||||||
GrantTypes []string `json:"grant_types,omitempty"`
|
GrantTypes []string `json:"grant_types,omitempty"`
|
||||||
ResponseTypes []string `json:"response_types,omitempty"`
|
ResponseTypes []string `json:"response_types,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user