feat: add SCIM provisioning via Okta (#4132)

Co-authored-by: Ben Potter <ben@coder.com>
This commit is contained in:
Colin Adler
2022-09-20 15:16:26 -05:00
committed by GitHub
parent 50321ba2aa
commit 5e2efb68f1
16 changed files with 467 additions and 13 deletions

View File

@ -37,6 +37,7 @@ func init() {
type Options struct {
*coderdtest.Options
EntitlementsUpdateInterval time.Duration
SCIMAPIKey []byte
}
// New constructs a codersdk client connected to an in-memory Enterprise API instance.
@ -55,6 +56,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,
SCIMAPIKey: options.SCIMAPIKey,
Options: oop,
EntitlementsUpdateInterval: options.EntitlementsUpdateInterval,
Keys: map[string]ed25519.PublicKey{
@ -82,6 +84,7 @@ type LicenseOptions struct {
ExpiresAt time.Time
UserLimit int64
AuditLog bool
SCIM bool
}
// AddLicense generates a new license with the options provided and inserts it.
@ -105,6 +108,11 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
if options.AuditLog {
auditLog = 1
}
scim := int64(0)
if options.SCIM {
scim = 1
}
c := &coderd.Claims{
RegisteredClaims: jwt.RegisteredClaims{
Issuer: "test@testing.test",
@ -119,6 +127,7 @@ func GenerateLicense(t *testing.T, options LicenseOptions) string {
Features: coderd.Features{
UserLimit: options.UserLimit,
AuditLog: auditLog,
SCIM: scim,
},
}
tok := jwt.NewWithClaims(jwt.SigningMethodEdDSA, c)