// ParseChallengeFromResponse ... func ParseChallengeFromResponse(resp *http.Response) []au.Challenge { challenges := au.ResponseChallenges(resp) log.Debugf("challenges: %v", challenges) return challenges }
func getAuthURLs(remoteURL string) ([]string, error) { authURLs := []string{} resp, err := http.Get(remoteURL + "/v2/") if err != nil { return nil, err } defer resp.Body.Close() for _, c := range auth.ResponseChallenges(resp) { if strings.EqualFold(c.Scheme, "bearer") { authURLs = append(authURLs, c.Parameters["realm"]) } } return authURLs, nil }
// ParseChallengeFromResponse ... func ParseChallengeFromResponse(resp *http.Response) []au.Challenge { challenges := au.ResponseChallenges(resp) return challenges }