Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error handling of misspelled IDPEndpoint ID #24

Open
JornWildt opened this issue Aug 18, 2020 · 0 comments
Open

Improved error handling of misspelled IDPEndpoint ID #24

JornWildt opened this issue Aug 18, 2020 · 0 comments

Comments

@JornWildt
Copy link

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.");
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant