// NewJwk NewJwk() get certificate from openIdConnect
NewJwk NewJwk() get certificate from openIdConnect
// NewJwk NewJwk () get certificate from openIdConnect
func NewJwk() (DiscoveryResponse, error) {
	c, _ := NewConfig()
	discoveryURI := strings.TrimSuffix(c.Issuer, "/") + "/.well-known/openid-configuration"
	client := http.Client{
		Timeout: 10 * time.Second,
	}
	res, err := client.Get(discoveryURI)
	if err != nil {
		return DiscoveryResponse{}, err
	}
	defer res.Body.Close()
	var discoResp struct {
		JwkURI             string `json:"jwks_uri"`
		RevocationEndpoint string `json:"revocation_endpoint"`
	}
	if err := json.NewDecoder(res.Body).Decode(&discoResp); err != nil {
		return DiscoveryResponse{}, err
	}
	res, err = client.Get(discoResp.JwkURI)
	if err != nil {
		return DiscoveryResponse{}, err
	}
	defer res.Body.Close()
	var keySet jose.JSONWebKeySet
	if err := json.NewDecoder(res.Body).Decode(&keySet); err != nil {
		return DiscoveryResponse{}, err
	}
	return DiscoveryResponse{
		RevocationEndpoint: discoResp.RevocationEndpoint,
		JSONWebKeySet:      &keySet,
	}, nil
}
func NewJwk ( ) ( DiscoveryResponse , error ) { c , _ := NewConfig ( ) discoveryURI := strings . TrimSuffix ( c . Issuer , " " ) + " " client := http . Client { Timeout : 10 * time . Second , } res , err := client . Get ( discoveryURI ) if err != nil { return DiscoveryResponse { } , err } defer res . Body . Close ( ) var discoResp struct { JwkURI string `json:"jwks_uri"` RevocationEndpoint string `json:"revocation_endpoint"` } if err := json . NewDecoder ( res . Body ) . Decode ( & discoResp ) ; err != nil { return DiscoveryResponse { } , err } res , err = client . Get ( discoResp . JwkURI ) if err != nil { return DiscoveryResponse { } , err } defer res . Body . Close ( ) var keySet jose . JSONWebKeySet if err := json . NewDecoder ( res . Body ) . Decode ( & keySet ) ; err != nil { return DiscoveryResponse { } , err } return DiscoveryResponse { RevocationEndpoint : discoResp . RevocationEndpoint , JSONWebKeySet : & keySet , } , nil }
NewJwk NewJwk() get certificate from openIdConnect
NewJwk NewJwk () get certificate from openIdConnect