Skip to content

Commit

Permalink
fix: resolve interface type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jul 27, 2020
1 parent b212d64 commit 064b305
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion driver/configuration/provider.go
Expand Up @@ -64,7 +64,7 @@ type Provider interface {

SecretsDefault() [][]byte
SecretsSession() [][]byte
SessionLifespan() time.Duration
SessionLifespan() *time.Duration
SessionSameSiteMode() http.SameSite
SessionDomain() string
SessionPath() string
Expand Down
9 changes: 7 additions & 2 deletions session/session.go
Expand Up @@ -39,11 +39,16 @@ func (s Session) TableName() string {
}

func NewSession(i *identity.Identity, c interface {
SessionLifespan() time.Duration
SessionLifespan() *time.Duration
}, authenticatedAt time.Time) *Session {
ttl := time.Hour * 6
if c.SessionLifespan() != nil {
ttl = *c.SessionLifespan()
}

return &Session{
ID: x.NewUUID(),
ExpiresAt: authenticatedAt.Add(c.SessionLifespan()),
ExpiresAt: authenticatedAt.Add(ttl),
AuthenticatedAt: authenticatedAt,
IssuedAt: time.Now().UTC(),
Identity: i,
Expand Down

0 comments on commit 064b305

Please sign in to comment.