feat: Add browser-only connections to Enterprise (#4135)

* feat: Add browser-only connections to Enterprise

Fixes #4131.

* Fix formatting
This commit is contained in:
Kyle Carberry
2022-09-22 10:14:22 -05:00
committed by GitHub
parent 656dcc0050
commit 7ad4276224
19 changed files with 263 additions and 41 deletions

View File

@ -36,6 +36,7 @@ func init() {
type Options struct {
*coderdtest.Options
BrowserOnly bool
EntitlementsUpdateInterval time.Duration
SCIMAPIKey []byte
}
@ -56,6 +57,7 @@ func NewWithAPI(t *testing.T, options *Options) (*codersdk.Client, io.Closer, *c
srv, cancelFunc, oop := coderdtest.NewOptions(t, options.Options)
coderAPI, err := coderd.New(context.Background(), &coderd.Options{
AuditLogging: true,
BrowserOnly: options.BrowserOnly,
SCIMAPIKey: options.SCIMAPIKey,
Options: oop,
EntitlementsUpdateInterval: options.EntitlementsUpdateInterval,
@ -84,6 +86,7 @@ type LicenseOptions struct {
ExpiresAt time.Time
UserLimit int64
AuditLog bool
BrowserOnly bool
SCIM bool
}
@ -108,6 +111,10 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
if options.AuditLog {
auditLog = 1
}
browserOnly := int64(0)
if options.BrowserOnly {
browserOnly = 1
}
scim := int64(0)
if options.SCIM {
scim = 1
@ -125,9 +132,10 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
AccountID: options.AccountID,
Version: coderd.CurrentVersion,
Features: coderd.Features{
UserLimit: options.UserLimit,
AuditLog: auditLog,
SCIM: scim,
UserLimit: options.UserLimit,
AuditLog: auditLog,
BrowserOnly: browserOnly,
SCIM: scim,
},
}
tok := jwt.NewWithClaims(jwt.SigningMethodEdDSA, c)