Skip to content

Improved error handling of misspelled IDPEndpoint ID #24

@JornWildt

Description

@JornWildt

One often occuring issue we see when installing OIOSAML based applications, is that the ID of an added IDPEndpoint is mispelled - leading to a situation where it cannot find the default IDPEndpoint. The endpoint is created, since it is added manually in the config file, but the metadata file is not found - resulting in an internal NULL pointer reference, which in turn leaves the person installing it without any clue about what is wrong.

Please make a very visible error message for this kind of situation, explaining what is wrong.

We have solved it by adding this check in SAML20FederationConfig:

    internal void Initialize()
        if (MetadataLocation == null)
            return;

        if (!Directory.Exists(MetadataLocation))
            throw new DirectoryNotFoundException(string.Format(Resources.MetadataLocationNotFound, MetadataLocation));

        string[] files = Directory.GetFiles(MetadataLocation, "*.config");
        foreach (string file in files)
        {
            HandleCreateIdp(file);
        }

        // CHECK METADATA FILE
        foreach (var idp in IDPEndPoints)
        {
            if (idp.metadata == null)
              throw new InvalidDataException($"The IDPEndpoint refering to id \"{idp.Id}\" does not have a corresponding metadata file.");
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions