Merge pull request #1762 from owncloud/ocis-1715-lighter-runtime

Lighter Runtime
This commit is contained in:
Jörn Friedrich Dreyer
2021-03-15 17:28:51 +01:00
committed by GitHub
182 changed files with 6580 additions and 2404 deletions
+31 -3
View File
@@ -1,6 +1,7 @@
package command
import (
"context"
"os"
"strings"
@@ -8,14 +9,15 @@ import (
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/idp/pkg/flagset"
"github.com/owncloud/ocis/idp/pkg/version"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/spf13/viper"
"github.com/thejerf/suture/v4"
)
// Execute is the entry point for the ocis-idp command.
func Execute() error {
cfg := config.New()
func Execute(cfg *config.Config) error {
app := &cli.App{
Name: "ocis-idp",
Version: version.String,
@@ -68,6 +70,8 @@ func NewLogger(cfg *config.Config) log.Logger {
// ParseConfig load configuration for every extension
func ParseConfig(c *cli.Context, cfg *config.Config) error {
sync.ParsingViperConfig.Lock()
defer sync.ParsingViperConfig.Unlock()
logger := NewLogger(cfg)
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
@@ -108,3 +112,27 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
return nil
}
// SutureService allows for the idp command to be embedded and supervised by a suture supervisor tree.
type SutureService struct {
cfg *config.Config
}
// NewSutureService creates a new idp.SutureService
func NewSutureService(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.IDP.Supervised = true
}
return SutureService{
cfg: cfg.IDP,
}
}
func (s SutureService) Serve(ctx context.Context) error {
s.cfg.Context = ctx
if err := Execute(s.cfg); err != nil {
return err
}
return nil
}
+28 -51
View File
@@ -2,11 +2,11 @@ package command
import (
"context"
"os"
"os/signal"
"strings"
"time"
"github.com/owncloud/ocis/ocis-pkg/sync"
"contrib.go.opencensus.io/exporter/jaeger"
"contrib.go.opencensus.io/exporter/ocagent"
"contrib.go.opencensus.io/exporter/zipkin"
@@ -29,27 +29,31 @@ func Server(cfg *config.Config) *cli.Command {
Name: "server",
Usage: "Start integrated server",
Flags: flagset.ServerWithConfig(cfg),
Before: func(c *cli.Context) error {
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
// StringSliceFlag doesn't support Destination
// UPDATE Destination on string flags supported. Wait for https://github.com/urfave/cli/pull/1078 to get to micro/cli
if len(c.StringSlice("trusted-proxy")) > 0 {
cfg.IDP.TrustedProxy = c.StringSlice("trusted-proxy")
if len(ctx.StringSlice("trusted-proxy")) > 0 {
cfg.IDP.TrustedProxy = ctx.StringSlice("trusted-proxy")
}
if len(c.StringSlice("allow-scope")) > 0 {
cfg.IDP.AllowScope = c.StringSlice("allow-scope")
if len(ctx.StringSlice("allow-scope")) > 0 {
cfg.IDP.AllowScope = ctx.StringSlice("allow-scope")
}
if len(c.StringSlice("signing-private-key")) > 0 {
cfg.IDP.SigningPrivateKeyFiles = c.StringSlice("signing-private-key")
if len(ctx.StringSlice("signing-private-key")) > 0 {
cfg.IDP.SigningPrivateKeyFiles = ctx.StringSlice("signing-private-key")
}
return ParseConfig(c, cfg)
if !cfg.Supervised {
return ParseConfig(ctx, cfg)
}
logger.Debug().Str("service", "idp").Msg("ignoring config file parsing when running supervised")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
@@ -146,8 +150,13 @@ func Server(cfg *config.Config) *cli.Command {
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
metrics = metrics.New()
ctx, cancel = func() (context.Context, context.CancelFunc) {
if cfg.Context == nil {
return context.WithCancel(context.Background())
}
return context.WithCancel(cfg.Context)
}()
metrics = metrics.New()
)
defer cancel()
@@ -160,8 +169,6 @@ func Server(cfg *config.Config) *cli.Command {
http.Context(ctx),
http.Config(cfg),
http.Metrics(metrics),
http.Flags(flagset.RootWithConfig(config.New())),
http.Flags(flagset.ServerWithConfig(config.New())),
)
if err != nil {
@@ -192,48 +199,18 @@ func Server(cfg *config.Config) *cli.Command {
)
if err != nil {
logger.Info().
Err(err).
Str("transport", "debug").
Msg("Failed to initialize server")
logger.Info().Err(err).Str("transport", "debug").Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("transport", "debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("transport", "debug").
Msg("Shutting down server")
}
gr.Add(server.ListenAndServe, func(_ error) {
_ = server.Shutdown(ctx)
cancel()
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
if !cfg.Supervised {
sync.Trap(&gr, cancel)
}
return gr.Run()
+5
View File
@@ -1,6 +1,8 @@
package config
import (
"context"
"stash.kopano.io/kc/konnect/bootstrap"
)
@@ -75,6 +77,9 @@ type Config struct {
IDP bootstrap.Config
Ldap Ldap
Service Service
Context context.Context
Supervised bool
}
// New initializes a new configuration with or without defaults.
+53 -54
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/flags"
)
// RootWithConfig applies cfg to the root flagset
@@ -10,23 +11,20 @@ func RootWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "log-level",
Value: "info",
Usage: "Set logging level",
EnvVars: []string{"IDP_LOG_LEVEL"},
EnvVars: []string{"IDP_LOG_LEVEL", "OCIS_LOG_LEVEL"},
Destination: &cfg.Log.Level,
},
&cli.BoolFlag{
Value: true,
Name: "log-pretty",
Usage: "Enable pretty logging",
EnvVars: []string{"IDP_LOG_PRETTY"},
EnvVars: []string{"IDP_LOG_PRETTY", "OCIS_LOG_PRETTY"},
Destination: &cfg.Log.Pretty,
},
&cli.BoolFlag{
Value: true,
Name: "log-color",
Usage: "Enable colored logging",
EnvVars: []string{"IDP_LOG_COLOR"},
EnvVars: []string{"IDP_LOG_COLOR", "OCIS_LOG_COLOR"},
Destination: &cfg.Log.Color,
},
}
@@ -37,7 +35,7 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9134",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9134"),
Usage: "Address to debug endpoint",
EnvVars: []string{"IDP_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
@@ -50,7 +48,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "config-file",
Value: "",
Value: flags.OverrideDefaultString(cfg.File, ""),
Usage: "Path to config file",
EnvVars: []string{"IDP_CONFIG_FILE"},
Destination: &cfg.File,
@@ -63,42 +61,42 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "tracing-type",
Value: "jaeger",
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type",
EnvVars: []string{"IDP_TRACING_TYPE"},
Destination: &cfg.Tracing.Type,
},
&cli.StringFlag{
Name: "tracing-endpoint",
Value: "",
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
Usage: "Endpoint for the agent",
EnvVars: []string{"IDP_TRACING_ENDPOINT"},
Destination: &cfg.Tracing.Endpoint,
},
&cli.StringFlag{
Name: "tracing-collector",
Value: "",
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
Usage: "Endpoint for the collector",
EnvVars: []string{"IDP_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: "idp",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "idp"),
Usage: "Service name for tracing",
EnvVars: []string{"IDP_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9134",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9134"),
Usage: "Address to bind debug server",
EnvVars: []string{"IDP_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
&cli.StringFlag{
Name: "debug-token",
Value: "",
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
Usage: "Token to grant metrics access",
EnvVars: []string{"IDP_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
@@ -117,135 +115,135 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9130",
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9130"),
Usage: "Address to bind http server",
EnvVars: []string{"IDP_HTTP_ADDR"},
Destination: &cfg.HTTP.Addr,
},
&cli.StringFlag{
Name: "http-root",
Value: "/",
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
Usage: "Root path of http server",
EnvVars: []string{"IDP_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
},
&cli.StringFlag{
Name: "http-namespace",
Value: "com.owncloud.web",
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for service discovery",
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "name",
Value: "idp",
Value: flags.OverrideDefaultString(cfg.Service.Name, "idp"),
Usage: "Service name",
EnvVars: []string{"IDP_NAME"},
Destination: &cfg.Service.Name,
},
&cli.StringFlag{
Name: "identity-manager",
Value: "ldap",
Value: flags.OverrideDefaultString(cfg.IDP.IdentityManager, "ldap"),
Usage: "Identity manager (one of ldap,kc,cookie,dummy)",
EnvVars: []string{"IDP_IDENTITY_MANAGER"},
Destination: &cfg.IDP.IdentityManager,
},
&cli.StringFlag{
Name: "ldap-uri",
Value: "ldap://localhost:9125",
Value: flags.OverrideDefaultString(cfg.Ldap.URI, "ldap://localhost:9125"),
Usage: "URI of the LDAP server (glauth)",
EnvVars: []string{"IDP_LDAP_URI"},
Destination: &cfg.Ldap.URI,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: "cn=idp,ou=sysusers,dc=example,dc=org",
Value: flags.OverrideDefaultString(cfg.Ldap.BindDN, "cn=idp,ou=sysusers,dc=example,dc=org"),
Usage: "Bind DN for the LDAP server (glauth)",
EnvVars: []string{"IDP_LDAP_BIND_DN"},
Destination: &cfg.Ldap.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: "idp",
Value: flags.OverrideDefaultString(cfg.Ldap.BindPassword, "idp"),
Usage: "Password for the Bind DN of the LDAP server (glauth)",
EnvVars: []string{"IDP_LDAP_BIND_PASSWORD"},
Destination: &cfg.Ldap.BindPassword,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: "ou=users,dc=example,dc=org",
Value: flags.OverrideDefaultString(cfg.Ldap.BaseDN, "ou=users,dc=example,dc=org"),
Usage: "LDAP base DN of the oCIS users",
EnvVars: []string{"IDP_LDAP_BASE_DN"},
Destination: &cfg.Ldap.BaseDN,
},
&cli.StringFlag{
Name: "ldap-scope",
Value: "sub",
Value: flags.OverrideDefaultString(cfg.Ldap.Scope, "sub"),
Usage: "LDAP scope of the oCIS users",
EnvVars: []string{"IDP_LDAP_SCOPE"},
Destination: &cfg.Ldap.Scope,
},
&cli.StringFlag{
Name: "ldap-login-attribute",
Value: "cn",
Value: flags.OverrideDefaultString(cfg.Ldap.LoginAttribute, "cn"),
Usage: "LDAP login attribute of the oCIS users",
EnvVars: []string{"IDP_LDAP_LOGIN_ATTRIBUTE"},
Destination: &cfg.Ldap.LoginAttribute,
},
&cli.StringFlag{
Name: "ldap-email-attribute",
Value: "mail",
Value: flags.OverrideDefaultString(cfg.Ldap.EmailAttribute, "mail"),
Usage: "LDAP email attribute of the oCIS users",
EnvVars: []string{"IDP_LDAP_EMAIL_ATTRIBUTE"},
Destination: &cfg.Ldap.EmailAttribute,
},
&cli.StringFlag{
Name: "ldap-name-attribute",
Value: "sn",
Value: flags.OverrideDefaultString(cfg.Ldap.NameAttribute, "sn"),
Usage: "LDAP name attribute of the oCIS users",
EnvVars: []string{"IDP_LDAP_NAME_ATTRIBUTE"},
Destination: &cfg.Ldap.NameAttribute,
},
&cli.StringFlag{
Name: "ldap-uuid-attribute",
Value: "uid",
Value: flags.OverrideDefaultString(cfg.Ldap.UUIDAttribute, "uid"),
Usage: "LDAP UUID attribute of the oCIS users",
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE"},
Destination: &cfg.Ldap.UUIDAttribute,
},
&cli.StringFlag{
Name: "ldap-uuid-attribute-type",
Value: "text",
Value: flags.OverrideDefaultString(cfg.Ldap.UUIDAttributeType, "text"),
Usage: "LDAP UUID attribute type of the oCIS users",
EnvVars: []string{"IDP_LDAP_UUID_ATTRIBUTE_TYPE"},
Destination: &cfg.Ldap.UUIDAttributeType,
},
&cli.StringFlag{
Name: "ldap-filter",
Value: "(objectClass=posixaccount)",
Value: flags.OverrideDefaultString(cfg.Ldap.Filter, "(objectClass=posixaccount)"),
Usage: "LDAP filter of the oCIS users",
EnvVars: []string{"IDP_LDAP_FILTER"},
Destination: &cfg.Ldap.Filter,
},
&cli.StringFlag{
Name: "transport-tls-cert",
Value: "",
Value: flags.OverrideDefaultString(cfg.HTTP.TLSCert, ""),
Usage: "Certificate file for transport encryption",
EnvVars: []string{"IDP_TRANSPORT_TLS_CERT"},
Destination: &cfg.HTTP.TLSCert,
},
&cli.StringFlag{
Name: "transport-tls-key",
Value: "",
Value: flags.OverrideDefaultString(cfg.HTTP.TLSKey, ""),
Usage: "Secret file for transport encryption",
EnvVars: []string{"IDP_TRANSPORT_TLS_KEY"},
Destination: &cfg.HTTP.TLSKey,
},
&cli.StringFlag{
Name: "iss",
Value: flags.OverrideDefaultString(cfg.IDP.Iss, "https://localhost:9200"),
Usage: "OIDC issuer URL",
EnvVars: []string{"IDP_ISS", "OCIS_URL"}, // IDP_ISS takes precedence over OCIS_URL
Value: "https://localhost:9200",
Destination: &cfg.IDP.Iss,
},
&cli.StringSliceFlag{
@@ -258,68 +256,68 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
Name: "signing-kid",
Usage: "Value of kid field to use in created tokens (uniquely identifying the signing-private-key)",
EnvVars: []string{"IDP_SIGNING_KID"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.SigningKid, ""),
Destination: &cfg.IDP.SigningKid,
},
&cli.StringFlag{
Name: "validation-keys-path",
Usage: "Full path to a folder containg PEM encoded private or public key files used for token validaton (file name without extension is used as kid)",
EnvVars: []string{"IDP_VALIDATION_KEYS_PATH"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.ValidationKeysPath, ""),
Destination: &cfg.IDP.ValidationKeysPath,
},
&cli.StringFlag{
Name: "encryption-secret",
Usage: "Full path to a file containing a %d bytes secret key",
EnvVars: []string{"IDP_ENCRYPTION_SECRET"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.EncryptionSecretFile, ""),
Destination: &cfg.IDP.EncryptionSecretFile,
},
&cli.StringFlag{
Name: "signing-method",
Usage: "JWT default signing method",
EnvVars: []string{"IDP_SIGNING_METHOD"},
Value: "PS256",
Value: flags.OverrideDefaultString(cfg.IDP.SigningMethod, "PS256"),
Destination: &cfg.IDP.SigningMethod,
},
&cli.StringFlag{
Name: "uri-base-path",
Usage: "Custom base path for URI endpoints",
EnvVars: []string{"IDP_URI_BASE_PATH"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.URIBasePath, ""),
Destination: &cfg.IDP.URIBasePath,
},
&cli.StringFlag{
Name: "sign-in-uri",
Usage: "Custom redirection URI to sign-in form",
EnvVars: []string{"IDP_SIGN_IN_URI"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.SignInURI, ""),
Destination: &cfg.IDP.SignInURI,
},
&cli.StringFlag{
Name: "signed-out-uri",
Usage: "Custom redirection URI to signed-out goodbye page",
EnvVars: []string{"IDP_SIGN_OUT_URI"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.SignedOutURI, ""),
Destination: &cfg.IDP.SignedOutURI,
},
&cli.StringFlag{
Name: "authorization-endpoint-uri",
Usage: "Custom authorization endpoint URI",
EnvVars: []string{"IDP_ENDPOINT_URI"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.AuthorizationEndpointURI, ""),
Destination: &cfg.IDP.AuthorizationEndpointURI,
},
&cli.StringFlag{
Name: "endsession-endpoint-uri",
Usage: "Custom endsession endpoint URI",
EnvVars: []string{"IDP_ENDSESSION_ENDPOINT_URI"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.EndsessionEndpointURI, ""),
Destination: &cfg.IDP.EndsessionEndpointURI,
},
&cli.StringFlag{
Name: "asset-path",
Value: "",
Value: flags.OverrideDefaultString(cfg.Asset.Path, ""),
Usage: "Path to custom assets",
EnvVars: []string{"IDP_ASSET_PATH"},
Destination: &cfg.Asset.Path,
@@ -328,21 +326,21 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
Name: "identifier-client-path",
Usage: "Path to the identifier web client base folder",
EnvVars: []string{"IDP_IDENTIFIER_CLIENT_PATH"},
Value: "/var/tmp/ocis/idp",
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierClientPath, "/var/tmp/ocis/idp"),
Destination: &cfg.IDP.IdentifierClientPath,
},
&cli.StringFlag{
Name: "identifier-registration-conf",
Usage: "Path to a identifier-registration.yaml configuration file",
EnvVars: []string{"IDP_IDENTIFIER_REGISTRATION_CONF"},
Value: "./config/identifier-registration.yaml",
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierRegistrationConf, "./config/identifier-registration.yaml"),
Destination: &cfg.IDP.IdentifierRegistrationConf,
},
&cli.StringFlag{
Name: "identifier-scopes-conf",
Usage: "Path to a scopes.yaml configuration file",
EnvVars: []string{"IDP_IDENTIFIER_SCOPES_CONF"},
Value: "",
Value: flags.OverrideDefaultString(cfg.IDP.IdentifierScopesConf, ""),
Destination: &cfg.IDP.IdentifierScopesConf,
},
&cli.BoolFlag{
@@ -355,7 +353,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
Name: "tls",
Usage: "Use TLS (disable only if idp is behind a TLS-terminating reverse-proxy).",
EnvVars: []string{"IDP_TLS"},
Value: false,
Value: flags.OverrideDefaultBool(cfg.HTTP.TLS, false),
Destination: &cfg.HTTP.TLS,
},
&cli.StringSliceFlag{
@@ -380,14 +378,14 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
Name: "allow-dynamic-client-registration",
Usage: "Allow dynamic OAuth2 client registration",
EnvVars: []string{"IDP_ALLOW_DYNAMIC_CLIENT_REGISTRATION"},
Value: true,
Value: flags.OverrideDefaultBool(cfg.IDP.AllowDynamicClientRegistration, true),
Destination: &cfg.IDP.AllowDynamicClientRegistration,
},
&cli.BoolFlag{
Name: "disable-identifier-webapp",
Usage: "Disable built-in identifier-webapp to use a frontend hosted elsewhere.",
EnvVars: []string{"IDP_DISABLE_IDENTIFIER_WEBAPP"},
Value: true,
Value: flags.OverrideDefaultBool(cfg.IDP.IdentifierClientDisabled, true),
Destination: &cfg.IDP.IdentifierClientDisabled,
},
&cli.Uint64Flag{
@@ -395,21 +393,22 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
Usage: "Expiration time of access tokens in seconds since generated",
EnvVars: []string{"IDP_ACCESS_TOKEN_EXPIRATION"},
Destination: &cfg.IDP.AccessTokenDurationSeconds,
Value: 60 * 10, // 10 Minutes.
Value: flags.OverrideDefaultUint64(cfg.IDP.AccessTokenDurationSeconds, 60*10), // 10 minutes
},
&cli.Uint64Flag{
Name: "id-token-expiration",
Usage: "Expiration time of id tokens in seconds since generated",
EnvVars: []string{"IDP_ID_TOKEN_EXPIRATION"},
Destination: &cfg.IDP.IDTokenDurationSeconds,
Value: 60 * 60, // 1 Hour
Value: flags.OverrideDefaultUint64(cfg.IDP.IDTokenDurationSeconds, 60*60), // 1 hour
},
&cli.Uint64Flag{
Name: "refresh-token-expiration",
Usage: "Expiration time of refresh tokens in seconds since generated",
EnvVars: []string{"IDP_REFRESH_TOKEN_EXPIRATION"},
Destination: &cfg.IDP.RefreshTokenDurationSeconds,
Value: 60 * 60 * 24 * 365 * 3, // 1 year
Value: flags.OverrideDefaultUint64(cfg.IDP.RefreshTokenDurationSeconds, 60*60*24*365*3), // 1 year
},
}
}
@@ -418,14 +417,14 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
func ListIDPWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{&cli.StringFlag{
Name: "http-namespace",
Value: "com.owncloud.web",
Value: flags.OverrideDefaultString(cfg.Service.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for service discovery",
EnvVars: []string{"IDP_HTTP_NAMESPACE"},
Destination: &cfg.Service.Namespace,
},
&cli.StringFlag{
Name: "name",
Value: "idp",
Value: flags.OverrideDefaultString(cfg.Service.Name, "idp"),
Usage: "Service name",
EnvVars: []string{"IDP_NAME"},
Destination: &cfg.Service.Name,