GithubHelp home page GithubHelp logo

saml2's People

Contributors

albinsunnanbo avatar andersabel avatar asupinski avatar bidou44 avatar blushingpenguin avatar doormalena avatar dufourpy avatar explunit avatar gastoncz avatar gheeres avatar henningjensen avatar henrikottesorensen avatar jimmytoenners avatar jobrolin avatar jpsullivan avatar lisabylund avatar mip1983 avatar plequang avatar raschmann avatar rasmuskl avatar robvanuden avatar rpmansion avatar rybama avatar swssolutions avatar tgardner avatar thomaslevesque avatar tobbeholmstrom avatar vladnedelescu avatar wagich avatar wjr- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saml2's Issues

HttpHandler vs HttpModule?

I started writing the Saml2AuthenticationModule as a HttpModule because WsFederationAuthenticationModule is a module. But while the WsFederationAuthModule works on any request that has the right form fields passed in, SAML2 works only on specific URLs. Looking closer at how IIS is designed it might make more sense to install the SAML2 handling as an http handler instead of as a http module.

ASP.NET Identity (OWIN) compatibility

The new ASP.NET Identity system contains functionality to handle external logins. Make a login provider working with ASP.NET Identity.

For now, it will be sufficient to create an Owin middleware that works with the ASP.NET Identity system when hosted on IIS. #82 takes this further and enables support for hosting outside of IIS.

Nuget readme

Readme in the nuget package that is autodisplayedk, including links to the documentation in the github repo.

Support of signed assertions

Saml2Response.Validate expects the Signature element as a child of the Response element(xmlDocument.DocumentElement). This signature element does not have to be present. It's able, that every Assertion element has a Signature element, containing the signature for the specific Assertion only.
ADFS2 just uses the signed assertions and omits the Signature element in Response.
Please adapt the signature validation in a way, that both possibilities are handled correctly.

Automated integration tests against StubIdp

Create automated integration tests (Coded UI Tests? Selenium?) that are run against the StubIdp, for both SampleMvcApplication (testing Kentor.AuthServices.Mvc) and SampleApplication (testing the Saml2AuthenticationModule).

Reject wrong XML Signature Transforms

XML signatures should only be accepted if they contain an enveloped signature. They may also contain EC14N canonicalization transform. If any other transforms are present, the signature should be rejected. See SAML2 Core 5.4.4.

Refactor error handling to use exceptions

Currently exceptions are caught by the commands and converted to proper CommandResults with errors. When moving to MVC controllers we want the exceptions to propagate, so the exception catching should be moved to Saml2AuthenticationModule instead.

Tests for #27 preserve whitespace

#27 Preserve whitespace when reading SAML response from Idp. was fixed without any unit tests being added.

Try to add a test if possible that fails when the PreserveWhitespace flag is false.

Basic Functionality

  • Be able to produce a AuthnRequest for an Idp over Redirect binding.
  • Be able to receive, validate and correctly handle a response over Post binding.

Stub Idp

A stub idp that can be used when testing full integration tests.

Handle correctly signed Saml2Response with incorrectly signed assertion embedded

A response could possibly have a correct signature on the entire message, while one or more assertions are separately signed with a signature that fails validation.

This situation should never be possible in the first place, but if it happens, it indicates a buggy IDP and I think that the entire response should be rejected in that case.

Run unit tests on deploy

Make a custom deploy.cmd for Kudu that runs the unit tests on deploy (and block if the tests fail).

Support for multiple IdPs

Add support for multiple IdPs.

A suggestion is to use ~/SamlAuthenticationModule/SignIn/IdpName and let the SignIn command check the config for an idp with name="IdpName". If no name is specified, the first idp should be used. This also requires Saml2AuthenticationModule.OnBeginRequest to break out the first part of the URL and pass any remaining parts to the command.Run() method.

Refactor Saml2AssertionExtensions.ToXElement

Refactor Saml2AssertionExtensions.ToXElement so that the subject and conditions are not handled in the same method. The handling of those should be moved to separate extension methods in separate classes. The tests in Saml2AssertionExtensionTests should be simplified to just check that the subject and assertion nodes are present. The contents themselves should be tested in the new tests for the new methods.

Change Saml2Response to use XDocument

Saml2Response uses XmlDocument to be able to use the XmlSignature class. Now, with the support of signed assertions everything is bounced over string formats anyway, so change Saml2Response to use XDocument instead.

Improve not found handling

Just setting 404 status for invalid URLs without any error message isn't very user friendly. Find out a better mechanism. Preferably one that integrates seamlessly with custom error pages used in the hosting application.

Use protocol classes instead of strings

In several places, strings are used for Ids etc, but there are built in classes that validates additional rules that should be used instead. Go through the entire library and fix.

Known issues:

  • Convert Saml2RequestBase.Id from string to Saml2Id

Documentation on GitHub

Documentation on GitHub.

  • Improved Readme.
  • Configuration reference and examples.
  • Contribution info.
  • Example application info.

Create tracing logging of relevant parts of the code

There are lots of ways validation can fail.
To help users of the authservices library to diagnose validation errors we should add trace logging before returning false in validation.
Make sure we don't leak security sensitive details.

Improve testing code coverage

There are some parts of the code outside Saml2AuthenticationModule that are not covered by tests. That should be fixed.

Better validate audience options

Create configurable options for validation of audience:

  • Always - require audience restrictions.
  • IfPresent - validate if there is a restriction in the answer.
  • Ignore - never validate.

Might be a good idea to move the setting to the identityProvider level to make it configurable on a per idp level.

MVC Controller

For MVC applications it would make more sense to have the SP as an MVC controller. It would allow error handling to be seamlessly integrated in the error handling of the application.

This probably requires some changes to how exceptions are handled in the ICommandimplementations and in CommandResult.

The MVC integration should go into an own lib/package so that the core lib isn't dependant on MVC.

Check Saml2Response.Validate on error messages

Check how Saml2Response.Validate works when there is a status message that is not "Success". Validate should not return true if the entire message is marked as an error. Figure out if it is best to return false or to throw an error (the latter would indicate that the caller should first check the result code before calling Validate).

Idp Metadata

Retreive and use Idp metadata instead of configuring everything. Including possibility to use a federation meta data source that contains info about several idps.

Refactor signature checking to own class

The signature validation in Saml2Response is getting quite big (and the corresponding tests are a bit messy as the handle complete Saml2Responses). Refactor the actual checking of the signature to an own helper class (extension method?) and move/simplify tests accordingly.

Improved generation SP Urls

Add possibility to automatically derive the ACS and discovery service response URLs from the current request.

Doing this will require each of the three APIs (http module, MVC Controller & Owin Middleware) to extract the base url of the application for each request. This probably interacts with #101.

Validate InResponseTo

Validate InResponse to in the saml responses. There are stub tests Saml2Response_Validate_FalseOnIncorrectInResponseTo, Saml2Response_Validate_FalseOnInvalidInResponseTo() and Saml2Response_Validate_FalseOnSecondInResponseTo() that should be implemented and should cover the functionality.

An idea for implementation:

  • Keep an in memory list of issued IDs.
  • Only accept incoming responses that are present in the list.
  • On accept: remove the id from the list.

This will work and will fails safe: if the server is restarted and the id is lost, the incoming response will be denied. A more complete implementation would retain used ids for some time and mark them as used. Ids that have timed out or been used should be removed after some time.

It might be possible to reuse the id cache used by DetectReplayedToken.

Allow bypass of AudienceRestriction

Create a configuration option to allow audience restrictions to be bypassed.

This requires a more flexible configuration handling to be able to inject different configs for different tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.