github.com/cozy/cozy-stack@v0.0.0-20240327093429-939e4a21320e/pkg/consts/token.go (about)

     1  package consts
     2  
     3  import "time"
     4  
     5  // This is the list of possible audience values for JWT.
     6  const (
     7  	AppAudience               = "app"          // used by client-side apps
     8  	KonnectorAudience         = "konn"         // used by konnectors
     9  	CLIAudience               = "cli"          // used by command line interface
    10  	ShareAudience             = "share"        // used for share by links code
    11  	RegistrationTokenAudience = "registration" // OAuth registration tokens
    12  	AccessTokenAudience       = "access"       // OAuth access tokens
    13  	RefreshTokenAudience      = "refresh"      // OAuth refresh tokens
    14  )
    15  
    16  // TokenValidityDuration is the duration where a token is valid in seconds (1 week)
    17  var (
    18  	DefaultValidityDuration = 24 * time.Hour
    19  
    20  	AppTokenValidityDuration       = 24 * time.Hour
    21  	KonnectorTokenValidityDuration = 30 * time.Minute
    22  	CLITokenValidityDuration       = 30 * time.Minute
    23  
    24  	AccessTokenValidityDuration = 7 * 24 * time.Hour
    25  )