func (api WorkerAPI) GetAuthorizedOidcProviders(requestInfo RequestInfo, resourceUrn string, action string, oidcProviders []OidcProvider) ([]OidcProvider, error) {
	resourcesToAuthorize := []Resource{}
	for _, oidcProvider := range oidcProviders {
		resourcesToAuthorize = append(resourcesToAuthorize, oidcProvider)
	}
	resources, err := api.getAuthorizedResources(requestInfo, resourceUrn, action, resourcesToAuthorize)
	if err != nil {
		return nil, err
	}
	oidcProvidersFiltered := []OidcProvider{}
	for _, res := range resources {
		oidcProvidersFiltered = append(oidcProvidersFiltered, res.(OidcProvider))
	}
	return oidcProvidersFiltered, nil
}
GetAuthorizedOidcProviders returns authorized OIDC providers for specified user combined with resource+action
package api
import (
	"fmt"
	"strings"
	"sync"
	"github.com/Tecsisa/foulkon/database"
)
type RequestInfo struct {
	Identifier string
	Admin      bool
	RequestID  string
}
type EffectRestriction struct {
	Effect       string        `json:"effect,omitempty"`
	Restrictions *Restrictions `json:"restrictions,omitempty"`
}
type Restrictions struct {
	AllowedUrnPrefixes []string `json:"allowedUrnPrefixes,omitempty"`
	AllowedFullUrns    []string `json:"allowedFullUrns,omitempty"`
	DeniedUrnPrefixes  []string `json:"deniedUrnPrefixes,omitempty"`
	DeniedFullUrns     []string `json:"deniedFullUrns,omitempty"`
}
type ExternalResource struct {
	Urn string `json:"urn,omitempty"`
}
func (e ExternalResource) GetUrn() string {
	return e.Urn
}
func (api WorkerAPI) GetAuthorizedUsers(requestInfo RequestInfo, resourceUrn string, action string, users []User) ([]User, error) {
	resourcesToAuthorize := []Resource{}
	for _, usr := range users {
		resourcesToAuthorize = append(resourcesToAuthorize, usr)
	}
	resources, err := api.getAuthorizedResources(requestInfo, resourceUrn, action, resourcesToAuthorize)
	if err != nil {
		return nil, err
	}
	usersFiltered := []User{}
	for _, res := range resources {
		usersFiltered = append(usersFiltered, res.(User))
	}
	return usersFiltered, nil
}
func (api WorkerAPI) GetAuthorizedGroups(requestInfo RequestInfo, resourceUrn string, action string, groups []Group) ([]Group, error) {
	resourcesToAuthorize := []Resource{}
	for _, group := range groups {
		resourcesToAuthorize = append(resourcesToAuthorize, group)
	}
	resources, err := api.getAuthorizedResources(requestInfo, resourceUrn, action, resourcesToAuthorize)
	if err != nil {
		return nil, err
	}
	groupsFiltered := []Group{}
	for _, res := range resources {
		groupsFiltered = append(groupsFiltered, res.(Group))
	}
	return groupsFiltered, nil
}
func (api WorkerAPI) GetAuthorizedPolicies(requestInfo RequestInfo, resourceUrn string, action string, policies []Policy) ([]Policy, error) {
	resourcesToAuthorize := []Resource{}
	for _, policy := range policies {
		resourcesToAuthorize = append(resourcesToAuthorize, policy)
	}
	resources, err := api.getAuthorizedResources(requestInfo, resourceUrn, action, resourcesToAuthorize)
	if err != nil {
		return nil, err
	}
	policiesFiltered := []Policy{}
	for _, res := range resources {
		policiesFiltered = append(policiesFiltered, res.(Policy))
	}
	return policiesFiltered, nil
}
func (api WorkerAPI) GetAuthorizedProxyResources(requestInfo RequestInfo, resourceUrn string, action string, proxyResources []ProxyResource) ([]ProxyResource, error) {
	resourcesToAuthorize := []Resource{}
	for _, proxyResource := range proxyResources {
		resourcesToAuthorize = append(resourcesToAuthorize, proxyResource)
	}
	resources, err := api.getAuthorizedResources(requestInfo, resourceUrn, action, resourcesToAuthorize)
	if err != nil {
		return nil, err
	}
	proxyResourcesFiltered := []ProxyResource{}
	for _, res := range resources {
		proxyResourcesFiltered = append(proxyResourcesFiltered, res.(ProxyResource))
	}
	return proxyResourcesFiltered, nil
}