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

Add SAML Service Provider library #99

Merged
merged 69 commits into from
Sep 22, 2023
Merged

Add SAML Service Provider library #99

merged 69 commits into from
Sep 22, 2023

Commits on Feb 24, 2023

  1. Add saml library

    hcjulz committed Feb 24, 2023
    Configuration menu
    Copy the full SHA
    271070e View commit details
    Browse the repository at this point in the history
  2. Update go version and modules

    hcjulz committed Feb 24, 2023
    Configuration menu
    Copy the full SHA
    844cf64 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    be8fcfd View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2023

  1. Add Certificate field

    hcjulz committed Mar 5, 2023
    Configuration menu
    Copy the full SHA
    07dc410 View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2023

  1. Parse SAML response

    hcjulz committed Mar 24, 2023
    Configuration menu
    Copy the full SHA
    6bfc10b View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2023

  1. Add saml response tests

    hcjulz committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    ebb26dd View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2023

  1. Parse more, test more

    hcjulz committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    78c96fb View commit details
    Browse the repository at this point in the history

Commits on May 16, 2023

  1. Use redirect binding

    hcjulz committed May 16, 2023
    Configuration menu
    Copy the full SHA
    34dfaa4 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2023

  1. go mods

    hcjulz committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    2e1bc6a View commit details
    Browse the repository at this point in the history
  2. Impl ParseResponse

    hcjulz committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    591348c View commit details
    Browse the repository at this point in the history
  3. Use URL type for URLs

    hcjulz committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    7643ae2 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2023

  1. Remove deps for saml

    hcjulz committed Jun 20, 2023
    Configuration menu
    Copy the full SHA
    6a481be View commit details
    Browse the repository at this point in the history
  2. Make saml its own module

    hcjulz committed Jun 20, 2023
    Configuration menu
    Copy the full SHA
    60ef9d1 View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2023

  1. Update go.mod

    hcjulz committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    74602fa View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2023

  1. print error

    hcjulz committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    c312bf9 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2023

  1. Implement config tests

    hcjulz committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    f73816c View commit details
    Browse the repository at this point in the history
  2. Read idp config env vars

    hcjulz committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    11a894d View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2023

  1. Add tests for sp.go

    As part of the tests, this commit refactors the sp.go and
    adds a test provider with the feature to serve a metadata xml.
    hcjulz committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    bde5b10 View commit details
    Browse the repository at this point in the history
  2. Rename method

    hcjulz committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    8ef39bf View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2023

  1. Merge pull request #80 from hashicorp/saml-lib-impl-config-tests

    Add tests for Config and ServiceProvider
    hcjulz authored Aug 7, 2023
    Configuration menu
    Copy the full SHA
    e191c39 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2023

  1. Configuration menu
    Copy the full SHA
    b68b83a View commit details
    Browse the repository at this point in the history
  2. Merge pull request #81 from hashicorp/saml-lib-creat-authn-req-tests

    Add tests for CreateAuthnRequest
    hcjulz authored Aug 8, 2023
    Configuration menu
    Copy the full SHA
    1c179e8 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2023

  1. Configuration menu
    Copy the full SHA
    72de8e3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b511766 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #82 from hashicorp/saml-lib-create-meta-options

    Add options for CreateMetadata and ParseResponse
    hcjulz authored Aug 9, 2023
    Configuration menu
    Copy the full SHA
    235b88d View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2023

  1. Generate xsd:id conform IDs

    hcjulz committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    fe26844 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #83 from hashicorp/saml-lib-generate-xsdid

    Generate xsd:id conform IDs
    hcjulz authored Aug 10, 2023
    Configuration menu
    Copy the full SHA
    a31bf9d View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2023

  1. Adds ability to provide IdP metadata as XML or individual parameters (#…

    …84)
    
    * Adds ability to provide IdP metadata as XML or individual parameters
    
    * DefaultGenerateAuthRequestID to GenerateAuthRequestID
    
    * improve error message for URL parsing config params
    austingebauer authored Aug 11, 2023
    Configuration menu
    Copy the full SHA
    dd6ca8a View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2023

  1. Add AuthnRequestRedirect tests

    hcjulz committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    fa03bb6 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2023

  1. Merge pull request #85 from hashicorp/saml-lib-add-redirect-tests

    Add  tests for `AuthnRequestRedirect`
    hcjulz authored Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3104a0a View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2023

  1. Configuration menu
    Copy the full SHA
    758097e View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2023

  1. Fix validUntil attribute

    `DescriptorCommon.ValidUntil` is a `time.Time` struct so the `omitempty`
    tag has no effect. This patch changes it to be a pointer so that it can
    be properly omitted.
    
    Also in CreateMetadata() we set both `ValidUntil` on the `EntityDescriptorSPSSO`
    and the inner `SPSSODescriptor`. The spec says
    
    	validUntil - Optional attribute indicates the expiration time of the
    	metadata contained in the element and any contained elements.
    
    so this is actually redundant.
    remilapeyre committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    963d010 View commit details
    Browse the repository at this point in the history
  2. Remove NameIDFormat default

    NameIDFormat is
    
    	Zero or more elements of type anyURI that enumerate the name identifier
    	formats supported by this system entity acting in this role. See Section
    	8.3 of [SAMLCore] for some possible values for this element.
    
    Vault (and I think Boundary also) do not need it to be an email, the name
    is used as an opaque string.
    
    I suppose most public IdP will have an email for their user but private
    ones may not have one and use an employee ID or a username instead.
    
    I think it's best to keep the default configuration empty to be compatible
    with such systems.
    remilapeyre committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    83bd1ed View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2023

  1. Configuration menu
    Copy the full SHA
    da17488 View commit details
    Browse the repository at this point in the history
  2. fix (saml): code refactoring (#93)

    * chore (saml): add demo binary to .gitignore
    
    * fix (saml): fix compilation and linter issues
    
    * chore (saml): fix some typos
    
    * fix (saml): code refactoring
    jimlambrt authored Aug 26, 2023
    Configuration menu
    Copy the full SHA
    81ba871 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2023

  1. Configuration menu
    Copy the full SHA
    28e6250 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2023

  1. Merge pull request #86 from remilapeyre/indent-xml

    Add Option to indent the XML Document
    hcjulz authored Aug 31, 2023
    Configuration menu
    Copy the full SHA
    e1e0b96 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #89 from remilapeyre/valid-until

    Fix validUntil attribute
    hcjulz authored Aug 31, 2023
    Configuration menu
    Copy the full SHA
    c094d93 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #90 from remilapeyre/saml-lib-name-id-format

    Remove NameIDFormat default
    hcjulz authored Aug 31, 2023
    Configuration menu
    Copy the full SHA
    662992f View commit details
    Browse the repository at this point in the history
  4. Merge pull request #94 from hashicorp/saml-lib-test-provider-post

    Implement HTTP-POST binding endpoint for the test provider
    hcjulz authored Aug 31, 2023
    Configuration menu
    Copy the full SHA
    20e4bdf View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2023

  1. Adds Response type definition using gosaml2 type (#96)

    * save progress
    
    * Adds Response type definition using gosaml2 type
    
    * Adds response test back
    austingebauer authored Sep 1, 2023
    Configuration menu
    Copy the full SHA
    d4e3e8f View commit details
    Browse the repository at this point in the history
  2. Add support for custom ACS URL in CreateAuthnRequest() and ParseRespo…

    …nse() (#95)
    
    * Add support for custom ACS URL in CreateAuthnRequest() and ParseResponse()
    
    The URL can now be customized using `WithAssertionConsumerServiceURL()`
    in both functions.
    
    To validate the behavior I added a short test for `ServiceProvider.ParseResponse`.
    It only checks the error to make sure `WithAssertionConsumerServiceURL()`
    for now but can be extended in the future.
    
    Also fix a docstring and gives the custom clock from `WithClock()` to the
    internal parser.
    
    * Fix code review
    remilapeyre authored Sep 1, 2023
    Configuration menu
    Copy the full SHA
    984a901 View commit details
    Browse the repository at this point in the history
  3. Run the tests in CI (#97)

    * Run the tests in CI
    
    When can remove this before merging on master but it would be good to have the CI working on our branch
    
    * Backport of 5283f33
    remilapeyre authored Sep 1, 2023
    Configuration menu
    Copy the full SHA
    f457d6d View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2023

  1. Configuration menu
    Copy the full SHA
    5eb0db6 View commit details
    Browse the repository at this point in the history
  2. remove saml-lib branch

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    2adf73d View commit details
    Browse the repository at this point in the history
  3. Add .gitignore to demo module

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    bf2781a View commit details
    Browse the repository at this point in the history
  4. Undo changes in oidc package

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    7246b1b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    83f7531 View commit details
    Browse the repository at this point in the history
  6. Merge pull request #100 from hashicorp/saml-lib-fixup-modules

    SAML Library fixup
    hcjulz authored Sep 9, 2023
    Configuration menu
    Copy the full SHA
    d255ea8 View commit details
    Browse the repository at this point in the history
  7. Use error from saml lib

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    319eae1 View commit details
    Browse the repository at this point in the history
  8. go mod tidy

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    3ae9339 View commit details
    Browse the repository at this point in the history
  9. saml: minor code improvements (#101)

    * fix (saml): address possible panic if clock.Clock is nil
    
    * fix (saml): fix possible panic in WithAdditionalACSEndpoint(...)
    
    changed  location url to be passed by value to eliminate possible
    panic
    
    * refactor (saml): add WithMetadataNameIDFormat(...)
    
    Refactor WithAdditionalNameIDFormat(...) and WithNameIDFormats(...)
    into one new option WithMetadataNameIDFormat(...)
    
    * fix (saml): address possible panics in saml handlers
    
    * tests (saml): minor code improvements
    jimlambrt authored Sep 9, 2023
    Configuration menu
    Copy the full SHA
    3a603e1 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    196ed07 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    922e227 View commit details
    Browse the repository at this point in the history
  12. Handle possible panic

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    65e368b View commit details
    Browse the repository at this point in the history
  13. Return proper errors

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    136094c View commit details
    Browse the repository at this point in the history
  14. Add comment

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    c2acd28 View commit details
    Browse the repository at this point in the history
  15. Wrap errors

    hcjulz committed Sep 9, 2023
    Configuration menu
    Copy the full SHA
    cb03a93 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2023

  1. Merge pull request #103 from hashicorp/saml-lib-fixup-julz2

    More SAML library fixes
    hcjulz authored Sep 10, 2023
    Configuration menu
    Copy the full SHA
    6f5c72b View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2023

  1. Add caching support to IDPMetadata() (#102)

    * Add caching support to IDPMetadata()
    
    Caching the metadata document will avoid an additional round-trip to the
    IDP for every connection.
    
    The Metadata for the OASIS Security Assertion Markup Language says
    regarding caching:
    
    	4.3 Post-Processing of Metadata
    	The following sections describe the post-processing of metadata.
    
    	4.3.1 Metadata Instance Caching
    	[E94] Document caching MUST be based on the duration indicated by the cacheDuration attribute of
    	the subject element(s). If metadata elements have parent elements which contain caching policies, the
    	parent element takes precedence. To properly process the cacheDuration attribute, consumers must
    	retain the date and time when an instance was obtained.
    
    	Note that cache expiration does not imply a lack of validity in the absence of a validUntil attribute or
    	other information; failure to update a cached instance (e.g., due to network failure) need not render
    	metadata invalid, although implementations may offer such controls to deployers.
    	When a document or element has expired, the consumer MUST retrieve a fresh copy, which may require
    	a refresh of the document location(s). Consumers SHOULD process document cache processing
    	according to [RFC2616] Section 13, and MAY request the Last-Modified date and time from the HTTP
    	server. Publishers SHOULD ensure acceptable cache processing as described in [RFC2616] (Section
    	10.3.5 304 Not Modified).
    
    	4.3.2 [E94] Metadata Instance Validity
    	Metadata MUST be considered invalid upon reaching the time specified in a validUntil attribute of the
    	subject element(s). The effective expiration may be adjusted downward by parent element(s) with earlier
    	expirations. Invalid metadata MUST NOT be used. This contrasts with "stale" metadata that may be
    	beyond its optimum cache duration but is not explicitly invalid. Such metadata remains valid and MAY be
    	used at the discretion of the implementation.
    
    With this change the cached metadata is used until it expires. This behavior
    can be disabled using WithCache().
    
    Using a stale document when refreshing it fails is disabled by default
    and users can opt-in using WithStale().
    
    * Address code review comments
    
    * Run go mod tidy
    
    * Run go mod tidy
    
    * Update saml/sp_test.go
    
    Co-authored-by: Jim <[email protected]>
    
    ---------
    
    Co-authored-by: Jim <[email protected]>
    remilapeyre and jimlambrt authored Sep 13, 2023
    Configuration menu
    Copy the full SHA
    b0ed5aa View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2023

  1. refact (saml): ServiceProvider.ParseResponse(...) improvements (#105)

    A small refactor and added more unit tests
    jimlambrt authored Sep 14, 2023
    Configuration menu
    Copy the full SHA
    ee37514 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    52c8419 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2023

  1. saml: adds helpers for response assertions, subject, issuer, and attr…

    …ibutes (#104)
    
    * saml: adds helpers for response assertions, subject, and attributes
    
    * fix up comment
    
    * Restructure test, add coverage, add issuer helpers
    austingebauer authored Sep 15, 2023
    Configuration menu
    Copy the full SHA
    a92758c View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2023

  1. Add saml to README

    hcjulz committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    819315e View commit details
    Browse the repository at this point in the history
  2. Merge pull request #110 from hashicorp/saml-lib-readme

    Add SAML to README
    hcjulz authored Sep 20, 2023
    Configuration menu
    Copy the full SHA
    e0aaca8 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2023

  1. Configuration menu
    Copy the full SHA
    c4603a1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7947406 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b261a01 View commit details
    Browse the repository at this point in the history
  4. fix small typo/type

    austingebauer committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    9346964 View commit details
    Browse the repository at this point in the history