@@ -92,6 +92,25 @@ func baseSnapshotFromOptions(opts Options) dataupload.Snapshot {
9292 }
9393}
9494
95+ // extractOIDCFromReading converts the opaque data from a DiscoveryData
96+ // data reading to allow access to the OIDC fields within.
97+ func extractOIDCFromReading (reading * api.DataReading , target * dataupload.Snapshot ) error {
98+ if reading == nil {
99+ return fmt .Errorf ("programmer mistake: the DataReading must not be nil" )
100+ }
101+ data , ok := reading .Data .(* api.OIDCDiscoveryData )
102+ if ! ok {
103+ return fmt .Errorf (
104+ "programmer mistake: the DataReading must have data type *api.DiscoveryData. " +
105+ "This DataReading (%s) has data type %T" , reading .DataGatherer , reading .Data )
106+ }
107+ target .OIDCConfig = data .OIDCConfig
108+ target .OIDCConfigError = data .OIDCConfigError
109+ target .JWKS = data .JWKS
110+ target .JWKSError = data .JWKSError
111+ return nil
112+ }
113+
95114// extractClusterIDAndServerVersionFromReading converts the opaque data from a DiscoveryData
96115// data reading to allow access to the Kubernetes version fields within.
97116func extractClusterIDAndServerVersionFromReading (reading * api.DataReading , target * dataupload.Snapshot ) error {
@@ -149,6 +168,7 @@ func extractResourceListFromReading(reading *api.DataReading, target *[]runtime.
149168// and populates the relevant field(s) of the Snapshot based on the DataReading's data.
150169// Deleted resources are excluded from the snapshot because they are not needed by CyberArk.
151170var defaultExtractorFunctions = map [string ]func (* api.DataReading , * dataupload.Snapshot ) error {
171+ "ark/oidc" : extractOIDCFromReading ,
152172 "ark/discovery" : extractClusterIDAndServerVersionFromReading ,
153173 "ark/secrets" : func (r * api.DataReading , s * dataupload.Snapshot ) error {
154174 return extractResourceListFromReading (r , & s .Secrets )
0 commit comments