Skip to content

Commit

Permalink
make ValidDuration configurable for IDP. (crewjam#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
like-a-bause authored and crewjam committed Nov 20, 2019
1 parent b09cf28 commit e2006e1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions identity_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,24 @@ type IdentityProvider struct {
SessionProvider SessionProvider
AssertionMaker AssertionMaker
SignatureMethod string
ValidDuration *time.Duration
}

// Metadata returns the metadata structure for this identity provider.
func (idp *IdentityProvider) Metadata() *EntityDescriptor {
certStr := base64.StdEncoding.EncodeToString(idp.Certificate.Raw)

var validDuration time.Duration
if idp.ValidDuration != nil {
validDuration = *idp.ValidDuration
} else {
validDuration = DefaultValidDuration
}

ed := &EntityDescriptor{
EntityID: idp.MetadataURL.String(),
ValidUntil: TimeNow().Add(DefaultValidDuration),
CacheDuration: DefaultValidDuration,
ValidUntil: TimeNow().Add(validDuration),
CacheDuration: validDuration,
IDPSSODescriptors: []IDPSSODescriptor{
{
SSODescriptor: SSODescriptor{
Expand Down

0 comments on commit e2006e1

Please sign in to comment.