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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
271070e
Add saml library
hcjulz Feb 24, 2023
844cf64
Update go version and modules
hcjulz Feb 24, 2023
be8fcfd
Create acs and metadata handlers
hcjulz Feb 24, 2023
07dc410
Add Certificate field
hcjulz Mar 5, 2023
6bfc10b
Parse SAML response
hcjulz Mar 24, 2023
ebb26dd
Add saml response tests
hcjulz Mar 31, 2023
78c96fb
Parse more, test more
hcjulz Apr 6, 2023
34dfaa4
Use redirect binding
hcjulz May 16, 2023
2e1bc6a
go mods
hcjulz Jun 19, 2023
591348c
Impl ParseResponse
hcjulz Jun 19, 2023
7643ae2
Use URL type for URLs
hcjulz Jun 19, 2023
6a481be
Remove deps for saml
hcjulz Jun 20, 2023
60ef9d1
Make saml its own module
hcjulz Jun 20, 2023
74602fa
Update go.mod
hcjulz Jun 22, 2023
c312bf9
print error
hcjulz Jun 23, 2023
f73816c
Implement config tests
hcjulz Aug 3, 2023
11a894d
Read idp config env vars
hcjulz Aug 3, 2023
bde5b10
Add tests for sp.go
hcjulz Aug 6, 2023
8ef39bf
Rename method
hcjulz Aug 6, 2023
e191c39
Merge pull request #80 from hashicorp/saml-lib-impl-config-tests
hcjulz Aug 7, 2023
b68b83a
Add tests for CreateAuthnRequest
hcjulz Aug 8, 2023
1c179e8
Merge pull request #81 from hashicorp/saml-lib-creat-authn-req-tests
hcjulz Aug 8, 2023
72de8e3
Add insecure options to response parser
hcjulz Aug 9, 2023
b511766
Add options for CreateMetadata
hcjulz Aug 9, 2023
235b88d
Merge pull request #82 from hashicorp/saml-lib-create-meta-options
hcjulz Aug 9, 2023
fe26844
Generate xsd:id conform IDs
hcjulz Aug 10, 2023
a31bf9d
Merge pull request #83 from hashicorp/saml-lib-generate-xsdid
hcjulz Aug 10, 2023
dd6ca8a
Adds ability to provide IdP metadata as XML or individual parameters …
austingebauer Aug 11, 2023
fa03bb6
Add AuthnRequestRedirect tests
hcjulz Aug 18, 2023
3104a0a
Merge pull request #85 from hashicorp/saml-lib-add-redirect-tests
hcjulz Aug 21, 2023
758097e
Add Option to indent the XML Document
remilapeyre Aug 23, 2023
963d010
Fix validUntil attribute
remilapeyre Aug 25, 2023
83bd1ed
Remove NameIDFormat default
remilapeyre Aug 25, 2023
da17488
Update saml/models/core/request.go
remilapeyre Aug 26, 2023
81ba871
fix (saml): code refactoring (#93)
jimlambrt Aug 26, 2023
28e6250
Impl post binding endpoint on test provider
hcjulz Aug 30, 2023
e1e0b96
Merge pull request #86 from remilapeyre/indent-xml
hcjulz Aug 31, 2023
c094d93
Merge pull request #89 from remilapeyre/valid-until
hcjulz Aug 31, 2023
662992f
Merge pull request #90 from remilapeyre/saml-lib-name-id-format
hcjulz Aug 31, 2023
20e4bdf
Merge pull request #94 from hashicorp/saml-lib-test-provider-post
hcjulz Aug 31, 2023
d4e3e8f
Adds Response type definition using gosaml2 type (#96)
austingebauer Sep 1, 2023
984a901
Add support for custom ACS URL in CreateAuthnRequest() and ParseRespo…
remilapeyre Sep 1, 2023
f457d6d
Run the tests in CI (#97)
remilapeyre Sep 1, 2023
5eb0db6
Undo changes in the main module
hcjulz Sep 9, 2023
2adf73d
remove saml-lib branch
hcjulz Sep 9, 2023
bf2781a
Add .gitignore to demo module
hcjulz Sep 9, 2023
7246b1b
Undo changes in oidc package
hcjulz Sep 9, 2023
83f7531
Remove demo from main gitignore
hcjulz Sep 9, 2023
d255ea8
Merge pull request #100 from hashicorp/saml-lib-fixup-modules
hcjulz Sep 9, 2023
319eae1
Use error from saml lib
hcjulz Sep 9, 2023
3ae9339
go mod tidy
hcjulz Sep 9, 2023
3a603e1
saml: minor code improvements (#101)
jimlambrt Sep 9, 2023
196ed07
Add comment for postBindingScriptSha
hcjulz Sep 9, 2023
922e227
Add more info to WithNameIDFormat option
hcjulz Sep 9, 2023
65e368b
Handle possible panic
hcjulz Sep 9, 2023
136094c
Return proper errors
hcjulz Sep 9, 2023
c2acd28
Add comment
hcjulz Sep 9, 2023
cb03a93
Wrap errors
hcjulz Sep 9, 2023
6f5c72b
Merge pull request #103 from hashicorp/saml-lib-fixup-julz2
hcjulz Sep 10, 2023
b0ed5aa
Add caching support to IDPMetadata() (#102)
remilapeyre Sep 13, 2023
ee37514
refact (saml): ServiceProvider.ParseResponse(...) improvements (#105)
jimlambrt Sep 14, 2023
52c8419
tests (saml): add tests for WithMetadataParameter(...) option (#106)
jimlambrt Sep 14, 2023
a92758c
saml: adds helpers for response assertions, subject, issuer, and attr…
austingebauer Sep 15, 2023
819315e
Add saml to README
hcjulz Sep 20, 2023
e0aaca8
Merge pull request #110 from hashicorp/saml-lib-readme
hcjulz Sep 20, 2023
c4603a1
Merge branch 'main' of https://github.com/hashicorp/cap into saml-lib
austingebauer Sep 21, 2023
7947406
fix test to use response helpers
austingebauer Sep 21, 2023
b261a01
Update saml/models/core/common.go
austingebauer Sep 21, 2023
9346964
fix small typo/type
austingebauer Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,51 @@ if result.Success {
// user successfully authenticated...
if len(result.Groups) > 0 {
// we found some groups associated with the authenticated user...
}
}
}
```

### [`saml package`](./saml)

A package for writing clients that integrate with SAML Providers.

The SAML library orients mainly on the implementation profile for
[federation interoperability](https://kantarainitiative.github.io/SAMLprofiles/fedinterop.html)
(also known as interoperable SAML), a set of software conformance requirements
intended to facilitate interoperability within the context of full mesh identity
federations. It supports the Web Browser SSO profile with HTTP-Post and
HTTP-Redirect as supported service bindings. The default SAML settings follow
the requirements of the interoperable SAML
[deployment profile](https://kantarainitiative.github.io/SAMLprofiles/saml2int.html#_service_provider_requirements).

#### Example usage

```go
// Create a new saml config providing the necessary provider information:
cfg, err := saml.NewConfig(<entityID>, <acs>, <metadata>, options...)
// handle error

// Use the config to create the service provider:
sp, err := saml.NewServiceProvider(cfg)
// handle error

// With the service provider you can create saml authentication requests:

// Generate a saml auth request with HTTP Post-Binding
template, err := sp.AuthRequestPost("relay state", options...)
// handle error

// Generate a saml auth request with HTTP Request-Binding
redirectURL, err := sp.AuthRequestRedirect("relay state", options...)
// handle error

// Parsing a SAML response:
r.ParseForm()
samlResp := r.PostForm.Get("SAMLResponse")

response, err := sp.ParseResponse(samlResp, "Response ID", options...)
// handle error
```

You can find the full demo code in the [`saml/demo`](./saml/demo/main.go)
package.
Loading
Loading