- let ocis init generate jwt token for collaboration service

- separate REVA jwt secret from WOPI jwt secret
- fix gatway service name configuration
This commit is contained in:
Willy Kloucek
2024-05-24 12:43:53 +02:00
committed by Jörn Friedrich Dreyer
parent 7b47d55837
commit 901a5e27fc
5 changed files with 15 additions and 6 deletions
+12
View File
@@ -156,6 +156,10 @@ type Clientlog struct {
ServiceAccount ServiceAccount `yaml:"service_account"` ServiceAccount ServiceAccount `yaml:"service_account"`
} }
type Collaboration struct {
JWTSecret string `yaml:"jwt_secret"`
}
type Nats struct { type Nats struct {
// The nats config has a field called nats // The nats config has a field called nats
Nats struct { Nats struct {
@@ -191,6 +195,7 @@ type OcisConfig struct {
Graph GraphService Graph GraphService
Idp LdapBasedService Idp LdapBasedService
Idm IdmService Idm IdmService
Collaboration Collaboration
Proxy ProxyService Proxy ProxyService
Frontend FrontendService Frontend FrontendService
AuthBasic AuthbasicService `yaml:"auth_basic"` AuthBasic AuthbasicService `yaml:"auth_basic"`
@@ -289,6 +294,10 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
if err != nil { if err != nil {
return fmt.Errorf("could not generate random password for tokenmanager: %s", err) return fmt.Errorf("could not generate random password for tokenmanager: %s", err)
} }
collaborationJwtSecret, err := generators.GenerateRandomPassword(passwordLength)
if err != nil {
return fmt.Errorf("could not generate random password for collaboration service: %s", err)
}
machineAuthAPIKey, err := generators.GenerateRandomPassword(passwordLength) machineAuthAPIKey, err := generators.GenerateRandomPassword(passwordLength)
if err != nil { if err != nil {
return fmt.Errorf("could not generate random password for machineauthsecret: %s", err) return fmt.Errorf("could not generate random password for machineauthsecret: %s", err)
@@ -344,6 +353,9 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
}, },
}, },
}, },
Collaboration: Collaboration{
JWTSecret: collaborationJwtSecret,
},
Groups: UsersAndGroupsService{ Groups: UsersAndGroupsService{
Drivers: LdapBasedService{ Drivers: LdapBasedService{
Ldap: LdapSettings{ Ldap: LdapSettings{
+1 -1
View File
@@ -10,7 +10,7 @@ The collaboration service requires the target document server (ONLYOFFICE, Colla
* External document server. * External document server.
* The gateway service. * The gateway service.
* The app-provider service. * The app-registry service.
If any of the named services above have not been started or are not reachable, the collaboration service won't start. For the binary or the docker release of Infinite Scale, check with the `ocis list` command if they have been started. If not, you must start them manually upfront before starting the collaboration service. If any of the named services above have not been started or are not reachable, the collaboration service won't start. For the binary or the docker release of Infinite Scale, check with the `ocis list` command if they have been started. If not, you must start them manually upfront before starting the collaboration service.
+1 -1
View File
@@ -14,7 +14,7 @@ type Config struct {
Service Service `yaml:"-"` Service Service `yaml:"-"`
App App `yaml:"app"` App App `yaml:"app"`
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;COLLABORATION_JWT_SECRET" desc:"Used as JWT token and to encrypt access token." introductionVersion:"5.1"` JWTSecret string `yaml:"jwt_secret" env:"COLLABORATION_JWT_SECRET" desc:"Used as mint and verify WOPI JWT tokens and encrypt and decrypt the REVA JWT token embedded in the WOPI JWT token." introductionVersion:"5.1"`
GRPC GRPC `yaml:"grpc"` GRPC GRPC `yaml:"grpc"`
HTTP HTTP `yaml:"http"` HTTP HTTP `yaml:"http"`
+1 -1
View File
@@ -8,7 +8,7 @@ type CS3Api struct {
// Gateway defines the available configuration for the CS3 API gateway // Gateway defines the available configuration for the CS3 API gateway
type Gateway struct { type Gateway struct {
Name string `yaml: "name" env:"OCIS_REVA_GATEWAY;COLLABORATION_CS3API_GATEWAY_NAME" desc:"The service name of the CS3API gateway." introductionVersion:"5.1"` Name string `yaml:"name" env:"OCIS_REVA_GATEWAY;COLLABORATION_CS3API_GATEWAY_NAME" desc:"The service name of the CS3API gateway." introductionVersion:"5.1"`
} }
// DataGateway defines the available configuration for the CS3 API data gateway // DataGateway defines the available configuration for the CS3 API data gateway
@@ -1,7 +1,6 @@
package defaults package defaults
import ( import (
"github.com/owncloud/ocis/v2/ocis-pkg/generators"
"github.com/owncloud/ocis/v2/services/collaboration/pkg/config" "github.com/owncloud/ocis/v2/services/collaboration/pkg/config"
) )
@@ -15,7 +14,6 @@ func FullDefaultConfig() *config.Config {
// DefaultConfig returns a basic default configuration // DefaultConfig returns a basic default configuration
func DefaultConfig() *config.Config { func DefaultConfig() *config.Config {
secret, _ := generators.GenerateRandomString(generators.AlphaNumChars, 32) // anything to do with the error?
return &config.Config{ return &config.Config{
Service: config.Service{ Service: config.Service{
Name: "collaboration", Name: "collaboration",
@@ -26,7 +24,6 @@ func DefaultConfig() *config.Config {
Icon: "image-edit", Icon: "image-edit",
LockName: "com.github.owncloud.collaboration", LockName: "com.github.owncloud.collaboration",
}, },
JWTSecret: secret,
GRPC: config.GRPC{ GRPC: config.GRPC{
Addr: "0.0.0.0:9301", Addr: "0.0.0.0:9301",
Namespace: "com.owncloud.collaboration", Namespace: "com.owncloud.collaboration",