forked from baron/baron-sso
adminfront/devfront 앱 실행 기본 URL 설정
This commit is contained in:
@@ -3388,13 +3388,11 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
||||
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)
|
||||
}
|
||||
}
|
||||
clientURL := resolveLinkedRPURL(
|
||||
client.ClientID,
|
||||
client.ClientURI,
|
||||
client.RedirectURIs,
|
||||
)
|
||||
|
||||
lastAuth := time.Time{}
|
||||
if session.AuthenticatedAt != nil {
|
||||
@@ -3484,12 +3482,11 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
||||
name = client.ClientID
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
clientURL := resolveLinkedRPURL(
|
||||
client.ClientID,
|
||||
client.ClientURI,
|
||||
client.RedirectURIs,
|
||||
)
|
||||
|
||||
records[dc.ClientID] = &linkedRpRecord{
|
||||
linkedRpSummary: linkedRpSummary{
|
||||
@@ -5423,6 +5420,32 @@ func extractHydraClientLogo(metadata map[string]interface{}) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func resolveLinkedRPURL(clientID string, clientURI string, redirectURIs []string) string {
|
||||
switch strings.TrimSpace(clientID) {
|
||||
case "adminfront":
|
||||
if value := strings.TrimSpace(os.Getenv("ADMINFRONT_URL")); value != "" {
|
||||
return value
|
||||
}
|
||||
case "devfront":
|
||||
if value := strings.TrimSpace(os.Getenv("DEVFRONT_URL")); value != "" {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
clientURL := strings.TrimSpace(clientURI)
|
||||
if clientURL != "" {
|
||||
return clientURL
|
||||
}
|
||||
|
||||
if len(redirectURIs) > 0 {
|
||||
if parsed, err := url.Parse(redirectURIs[0]); err == nil {
|
||||
return fmt.Sprintf("%s://%s", parsed.Scheme, parsed.Host)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func mergeScopes(current []string, next []string) []string {
|
||||
if len(next) == 0 {
|
||||
return current
|
||||
|
||||
Reference in New Issue
Block a user