From 3434f089f7a5cd0baf0d3268d4a21ffb47450201 Mon Sep 17 00:00:00 2001 From: amlmtl <> Date: Fri, 8 Dec 2023 14:11:54 +0000 Subject: [PATCH] fix: revert OAuth passthrough for non-Viya deployments and treat websocket scheme as-is --- pkg/plugin/plugin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index a5a1a8c..f5d6062 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -92,6 +92,7 @@ type SampleDatasource struct { } type datasourceJsonData struct { + IsViya bool `json:"isViya"` UseInternalNetworking bool `json:"useInternalNetworking"` OauthPassThru bool `json:"oauthPassThru"` TlsSkipVerify bool `json:"tlsSkipVerify"` @@ -117,7 +118,7 @@ func (d *SampleDatasource) QueryData(ctx context.Context, req *backend.QueryData return nil, err } var authorizationHeaderPtr *string = nil - if jsonData.OauthPassThru { + if jsonData.OauthPassThru && jsonData.IsViya { authorizationHeader := req.GetHTTPHeader(backend.OAuthIdentityTokenHeaderName) authorizationHeaderPtr = &authorizationHeader } @@ -162,7 +163,6 @@ func (d *SampleDatasource) query(_ context.Context, datasourceUid string, qdto q return handleQueryError("invalid server URL", err) } serverUrl := s.GetUrl() - serverUrl.Scheme = "wss" q := query.New(serverUrl, qdto.ProjectName, qdto.CqName, qdto.WindowName, qdto.Interval, qdto.MaxDataPoints, qdto.Fields, authorizationHeader)