// New created a new Demo plugin.
New created a new Demo plugin.
// New created a new Demo plugin .
func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) {
	if config.VerifyJwt && len(config.JwksUrl) == 0 {
		return nil, fmt.Errorf("if veifyJwt is true then jwksUrl cannot be empty")
	}
	if len(config.ForwardedAuthHeader) == 0 {
		return nil, fmt.Errorf("forwardedUserHeader cannot be empty")
	}
	if len(config.IntrospectUrl) == 0 {
		return nil, fmt.Errorf("introspectUrl cannot be empty")
	}
	jwksSource := jwks.NewWebSource(config.JwksUrl)
	jwksC := jwks.NewDefaultClient(
		jwksSource,
		time.Hour,    
		12*time.Hour, 
	)
	return &PhantomPlugin{
		next:     next,
		name:     name,
		jwkClient: jwksC,
		config:   config,
		template: template.New("traefik_phantom_token").Delims("[[", "]]"),
	}, nil
}
func New ( ctx context . Context , next http . Handler , config * Config , name string ) ( http . Handler , error ) { if config . VerifyJwt && len ( config . JwksUrl ) == 0 { return nil , fmt . Errorf ( " " ) } if len ( config . ForwardedAuthHeader ) == 0 { return nil , fmt . Errorf ( " " ) } if len ( config . IntrospectUrl ) == 0 { return nil , fmt . Errorf ( " " ) } jwksSource := jwks . NewWebSource ( config . JwksUrl ) jwksC := jwks . NewDefaultClient ( jwksSource , time . Hour , 12 * time . Hour , ) return & PhantomPlugin { next : next , name : name , jwkClient : jwksC , config : config , template : template . New ( " " ) . Delims ( " " , " " ) , } , nil }
New created a new Demo plugin.
New created a new Demo plugin .
// Refresh keys every 1 hour // Expire keys after 12 hours