Commit 1df6f233 authored by ale's avatar ale

Support reading SAML XML descriptors from file or inline

parent 6182a298
Pipeline #4094 passed with stages
in 3 minutes and 22 seconds
......@@ -26,6 +26,8 @@ import (
)
type serviceProvider struct {
// Descriptor can either be an inline XML document, or it can
// be read from a file with the syntax "@filename".
Descriptor string `yaml:"descriptor"`
SSOGroups []string `yaml:"sso_groups"`
......@@ -81,9 +83,13 @@ func (c *Config) check() error {
func (c *Config) loadServiceProviders() error {
c.serviceProviderMap = make(map[string]*serviceProvider)
for _, sp := range c.ServiceProviders {
data, err := ioutil.ReadFile(sp.Descriptor)
if err != nil {
return err
var data []byte
if strings.HasPrefix(sp.Descriptor, "@") {
var err error
data, err = ioutil.ReadFile(sp.Descriptor[1:])
if err != nil {
return err
}
}
var ent saml.EntityDescriptor
if err := xml.Unmarshal(data, &ent); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment