@@ -104,6 +104,25 @@ func baseSnapshotFromOptions(opts Options) dataupload.Snapshot {
104104 }
105105}
106106
107+ // extractOIDCFromReading converts the opaque data from a OIDCDiscoveryData
108+ // data reading to allow access to the OIDC fields within.
109+ func extractOIDCFromReading (reading * api.DataReading , target * dataupload.Snapshot ) error {
110+ if reading == nil {
111+ return fmt .Errorf ("programmer mistake: the DataReading must not be nil" )
112+ }
113+ data , ok := reading .Data .(* api.OIDCDiscoveryData )
114+ if ! ok {
115+ return fmt .Errorf (
116+ "programmer mistake: the DataReading must have data type *api.OIDCDiscoveryData. " +
117+ "This DataReading (%s) has data type %T" , reading .DataGatherer , reading .Data )
118+ }
119+ target .OIDCConfig = data .OIDCConfig
120+ target .OIDCConfigError = data .OIDCConfigError
121+ target .JWKS = data .JWKS
122+ target .JWKSError = data .JWKSError
123+ return nil
124+ }
125+
107126// extractClusterIDAndServerVersionFromReading converts the opaque data from a DiscoveryData
108127// data reading to allow access to the Kubernetes version fields within.
109128func extractClusterIDAndServerVersionFromReading (reading * api.DataReading , target * dataupload.Snapshot ) error {
@@ -161,6 +180,7 @@ func extractResourceListFromReading(reading *api.DataReading, target *[]runtime.
161180// and populates the relevant field(s) of the Snapshot based on the DataReading's data.
162181// Deleted resources are excluded from the snapshot because they are not needed by CyberArk.
163182var defaultExtractorFunctions = map [string ]func (* api.DataReading , * dataupload.Snapshot ) error {
183+ "ark/oidc" : extractOIDCFromReading ,
164184 "ark/discovery" : extractClusterIDAndServerVersionFromReading ,
165185 "ark/secrets" : func (r * api.DataReading , s * dataupload.Snapshot ) error {
166186 return extractResourceListFromReading (r , & s .Secrets )
0 commit comments