Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/pydio/cells-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
bsinou committed Jun 13, 2024
2 parents 486f82c + 92b34a8 commit 4d56696
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 12 deletions.
135 changes: 135 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

- github.com/ajvb/kala/utils/iso8601 ([MIT](https://github.com/ajvb/kala/blob/v0.8.4/LICENSE))
- github.com/alessio/shellescape ([MIT](https://github.com/alessio/shellescape/blob/v1.4.1/LICENSE))
- github.com/beevik/ntp ([BSD-2-Clause](https://github.com/beevik/ntp/blob/v0.3.0/LICENSE))
- github.com/beorn7/perks/quantile ([MIT](https://github.com/beorn7/perks/blob/v1.0.1/LICENSE))
- github.com/caddyserver/caddy/v2 ([Apache-2.0](https://github.com/caddyserver/caddy/blob/v2.7.5/LICENSE))
- github.com/caddyserver/certmagic ([Apache-2.0](https://github.com/caddyserver/certmagic/blob/v0.20.0/LICENSE.txt))
- github.com/cespare/xxhash/v2 ([MIT](https://github.com/cespare/xxhash/blob/v2.2.0/LICENSE.txt))
- github.com/chzyer/readline ([MIT](https://github.com/chzyer/readline/blob/v1.5.1/LICENSE))
- github.com/cloudfoundry/jibber_jabber ([Apache-2.0](https://github.com/cloudfoundry/jibber_jabber/blob/bcc4c8345a21/LICENSE))
- github.com/cskr/pubsub ([BSD-2-Clause](https://github.com/cskr/pubsub/blob/v1.0.2/LICENSE))
- github.com/dlclark/regexp2 ([MIT](https://github.com/dlclark/regexp2/blob/v1.10.0/LICENSE))
- github.com/gabriel-vasile/mimetype ([MIT](https://github.com/gabriel-vasile/mimetype/blob/v1.4.2/LICENSE))
- github.com/getlantern/context ([Apache-2.0](https://github.com/getlantern/context/blob/c447772a6520/LICENSE))
- github.com/getlantern/errors ([Apache-2.0](https://github.com/getlantern/errors/blob/v1.0.1/LICENSE))
- github.com/getlantern/golog ([Apache-2.0](https://github.com/getlantern/golog/blob/d4d95a44d873/LICENSE))
- github.com/getlantern/hex ([BSD-3-Clause](https://github.com/getlantern/hex/blob/c6586a6fe0b7/LICENSE))
- github.com/getlantern/hidden ([Apache-2.0](https://github.com/getlantern/hidden/blob/f02dbb02be55/LICENSE))
- github.com/getlantern/ops ([Apache-2.0](https://github.com/getlantern/ops/blob/d70cb0d6f85f/LICENSE))
- github.com/getlantern/systray ([Apache-2.0](https://github.com/getlantern/systray/blob/v1.1.0/LICENSE))
- github.com/gin-contrib/cors ([MIT](https://github.com/gin-contrib/cors/blob/v1.3.1/LICENSE))
- github.com/gin-contrib/sse ([MIT](https://github.com/gin-contrib/sse/blob/v0.1.0/LICENSE))
- github.com/gin-contrib/static ([MIT](https://github.com/gin-contrib/static/blob/v0.0.1/LICENSE))
- github.com/gin-gonic/contrib/secure ([MIT](https://github.com/gin-gonic/contrib/blob/6a891bf89f19/LICENSE))
- github.com/gin-gonic/gin ([MIT](https://github.com/gin-gonic/gin/blob/v1.9.1/LICENSE))
- github.com/go-logr/logr ([Apache-2.0](https://github.com/go-logr/logr/blob/v1.4.1/LICENSE))
- github.com/go-playground/locales ([MIT](https://github.com/go-playground/locales/blob/v0.14.1/LICENSE))
- github.com/go-playground/universal-translator ([MIT](https://github.com/go-playground/universal-translator/blob/v0.18.1/LICENSE))
- github.com/go-playground/validator/v10 ([MIT](https://github.com/go-playground/validator/blob/v10.15.4/LICENSE))
- github.com/go-stack/stack ([MIT](https://github.com/go-stack/stack/blob/v1.8.1/LICENSE.md))
- github.com/gobwas/glob ([MIT](https://github.com/gobwas/glob/blob/v0.2.3/LICENSE))
- github.com/gogo/protobuf/proto ([BSD-3-Clause](https://github.com/gogo/protobuf/blob/v1.3.2/LICENSE))
- github.com/golang/groupcache/lru ([Apache-2.0](https://github.com/golang/groupcache/blob/41bb18bfe9da/LICENSE))
- github.com/golang/protobuf ([BSD-3-Clause](https://github.com/golang/protobuf/blob/v1.5.4/LICENSE))
- github.com/google/uuid ([BSD-3-Clause](https://github.com/google/uuid/blob/v1.6.0/LICENSE))
- github.com/googleapis/gax-go/v2 ([BSD-3-Clause](https://github.com/googleapis/gax-go/blob/v2.12.0/v2/LICENSE))
- github.com/gorilla/websocket ([BSD-2-Clause](https://github.com/gorilla/websocket/blob/v1.5.0/LICENSE))
- github.com/grpc-ecosystem/go-grpc-middleware ([Apache-2.0](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1.3.0/LICENSE))
- github.com/grpc-ecosystem/grpc-gateway/v2 ([BSD-3-Clause](https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.15.2/LICENSE.txt))
- github.com/h2non/filetype ([MIT](https://github.com/h2non/filetype/blob/v1.1.3/LICENSE))
- github.com/hashicorp/go-version ([MPL-2.0](https://github.com/hashicorp/go-version/blob/v1.6.0/LICENSE))
- github.com/hashicorp/golang-lru ([MPL-2.0](https://github.com/hashicorp/golang-lru/blob/v0.5.4/LICENSE))
- github.com/inconshreveable/go-update ([Apache-2.0](https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/LICENSE))
- github.com/inconshreveable/go-update/internal/binarydist ([MIT](https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/binarydist/License))
- github.com/inconshreveable/go-update/internal/osext ([BSD-3-Clause](https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/osext/LICENSE))
- github.com/jaytaylor/go-hostsfile ([MIT](https://github.com/jaytaylor/go-hostsfile/blob/61485ac1fa6c/LICENSE))
- github.com/json-iterator/go ([MIT](https://github.com/json-iterator/go/blob/v1.1.12/LICENSE))
- github.com/kardianos/service ([Zlib](https://github.com/kardianos/service/blob/9832e01049dd/LICENSE))
- github.com/karrick/godirwalk ([BSD-2-Clause](https://github.com/karrick/godirwalk/blob/v1.16.1/LICENSE))
- github.com/klauspost/compress/s2 ([BSD-3-Clause](https://github.com/klauspost/compress/blob/v1.17.0/s2/LICENSE))
- github.com/klauspost/cpuid/v2 ([MIT](https://github.com/klauspost/cpuid/blob/v2.2.7/LICENSE))
- github.com/leodido/go-urn ([MIT](https://github.com/leodido/go-urn/blob/v1.2.4/LICENSE))
- github.com/libdns/libdns ([MIT](https://github.com/libdns/libdns/blob/v0.2.2/LICENSE))
- github.com/manifoldco/promptui ([BSD-3-Clause](https://github.com/manifoldco/promptui/blob/v0.9.0/LICENSE.md))
- github.com/mattn/go-isatty ([MIT](https://github.com/mattn/go-isatty/blob/v0.0.19/LICENSE))
- github.com/mholt/acmez ([Apache-2.0](https://github.com/mholt/acmez/blob/v1.2.0/LICENSE))
- github.com/miekg/dns ([BSD-3-Clause](https://github.com/miekg/dns/blob/v1.1.58/LICENSE))
- github.com/minio/md5-simd ([Apache-2.0](https://github.com/minio/md5-simd/blob/v1.1.2/LICENSE))
- github.com/minio/minio-go/v7 ([Apache-2.0](https://github.com/minio/minio-go/blob/v7.0.36/LICENSE))
- github.com/minio/sha256-simd ([Apache-2.0](https://github.com/minio/sha256-simd/blob/v1.0.0/LICENSE))
- github.com/mitchellh/mapstructure ([MIT](https://github.com/mitchellh/mapstructure/blob/v1.5.0/LICENSE))
- github.com/modern-go/concurrent ([Apache-2.0](https://github.com/modern-go/concurrent/blob/bacd9c7ef1dd/LICENSE))
- github.com/modern-go/reflect2 ([Apache-2.0](https://github.com/modern-go/reflect2/blob/v1.0.2/LICENSE))
- github.com/mwitkow/go-proto-validators ([Apache-2.0](https://github.com/mwitkow/go-proto-validators/blob/v0.3.2/LICENSE.txt))
- github.com/nicksnyder/go-i18n/i18n ([MIT](https://github.com/nicksnyder/go-i18n/blob/v1.10.1/LICENSE))
- github.com/ory/ladon ([Apache-2.0](https://github.com/ory/ladon/blob/v1.2.0/LICENSE))
- github.com/ory/pagination ([Apache-2.0](https://github.com/ory/pagination/blob/v0.0.1/LICENSE))
- github.com/oxtoacart/bpool ([Apache-2.0](https://github.com/oxtoacart/bpool/blob/03653db5a59c/LICENSE))
- github.com/patrickmn/go-cache ([MIT](https://github.com/patrickmn/go-cache/blob/v2.1.0/LICENSE))
- github.com/pborman/uuid ([BSD-3-Clause](https://github.com/pborman/uuid/blob/v1.2.1/LICENSE))
- github.com/pelletier/go-toml ([Apache-2.0](https://github.com/pelletier/go-toml/blob/v1.9.5/LICENSE))
- github.com/pelletier/go-toml/v2 ([MIT](https://github.com/pelletier/go-toml/blob/v2.1.0/LICENSE))
- github.com/pkg/errors ([BSD-2-Clause](https://github.com/pkg/errors/blob/v0.9.1/LICENSE))
- github.com/prometheus/client_golang/prometheus ([Apache-2.0](https://github.com/prometheus/client_golang/blob/v1.19.0/LICENSE))
- github.com/prometheus/client_model/go ([Apache-2.0](https://github.com/prometheus/client_model/blob/v0.6.0/LICENSE))
- github.com/prometheus/common ([Apache-2.0](https://github.com/prometheus/common/blob/v0.51.1/LICENSE))
- github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg ([BSD-3-Clause](https://github.com/prometheus/common/blob/v0.51.1/internal/bitbucket.org/ww/goautoneg/README.txt))
- github.com/prometheus/procfs ([Apache-2.0](https://github.com/prometheus/procfs/blob/v0.13.0/LICENSE))
- github.com/pydio/caddyvault ([Apache-2.0](https://github.com/pydio/caddyvault/blob/v1.0.2/LICENSE.txt))
- github.com/pydio/cells-sync ([GPL-3.0](https://github.com/pydio/cells-sync/blob/HEAD/LICENSE))
- github.com/pydio/cells/v4 ([AGPL-3.0](https://github.com/pydio/cells/blob/c2197ebe73c9/LICENSE))
- github.com/pydio/go/docs ([AGPL-3.0](https://github.com/pydio/go/blob/d00ac19450ef/LICENSE))
- github.com/quic-go/qpack ([MIT](https://github.com/quic-go/qpack/blob/v0.4.0/LICENSE.md))
- github.com/quic-go/quic-go ([MIT](https://github.com/quic-go/quic-go/blob/v0.40.1/LICENSE))
- github.com/r3labs/diff/v3 ([MPL-2.0](https://github.com/r3labs/diff/blob/v3.0.0/LICENSE))
- github.com/rjeczalik/notify ([MIT](https://github.com/rjeczalik/notify/blob/v0.9.3/LICENSE))
- github.com/robertkrimen/otto ([MIT](https://github.com/robertkrimen/otto/blob/b87d35c0b86f/LICENSE))
- github.com/rs/xid ([MIT](https://github.com/rs/xid/blob/v1.5.0/LICENSE))
- github.com/shibukawa/configdir ([MIT](https://github.com/shibukawa/configdir/blob/e180dbdc8da0/LICENSE))
- github.com/skratchdot/open-golang/open ([MIT](https://github.com/skratchdot/open-golang/blob/eef842397966/LICENSE))
- github.com/spf13/afero ([Apache-2.0](https://github.com/spf13/afero/blob/v1.9.2/LICENSE.txt))
- github.com/spf13/cast ([MIT](https://github.com/spf13/cast/blob/v1.5.0/LICENSE))
- github.com/spf13/cobra ([Apache-2.0](https://github.com/spf13/cobra/blob/v1.7.0/LICENSE.txt))
- github.com/spf13/pflag ([BSD-3-Clause](https://github.com/spf13/pflag/blob/v1.0.5/LICENSE))
- github.com/thejerf/suture ([MIT](https://github.com/thejerf/suture/blob/v4.0.1/LICENSE))
- github.com/twmb/murmur3 ([BSD-3-Clause](https://github.com/twmb/murmur3/blob/v1.1.6/LICENSE))
- github.com/uber-go/tally/v4 ([MIT](https://github.com/uber-go/tally/blob/v4.1.2/LICENSE))
- github.com/ugorji/go/codec ([MIT](https://github.com/ugorji/go/blob/codec/v1.2.11/codec/LICENSE))
- github.com/vmihailenco/msgpack ([BSD-2-Clause](https://github.com/vmihailenco/msgpack/blob/v4.0.4/LICENSE))
- github.com/webview/webview_go ([MIT](https://github.com/webview/webview_go/blob/5a14030a9070/LICENSE))
- github.com/zalando/go-keyring ([MIT](https://github.com/zalando/go-keyring/blob/v0.2.1/LICENSE))
- github.com/zeebo/blake3 ([CC0-1.0](https://github.com/zeebo/blake3/blob/v0.2.3/LICENSE))
- go.etcd.io/bbolt ([MIT](https://github.com/etcd-io/bbolt/blob/v1.3.7/LICENSE))
- go.opencensus.io ([Apache-2.0](https://github.com/census-instrumentation/opencensus-go/blob/v0.24.0/LICENSE))
- go.uber.org/atomic ([MIT](https://github.com/uber-go/atomic/blob/v1.11.0/LICENSE.txt))
- go.uber.org/multierr ([MIT](https://github.com/uber-go/multierr/blob/v1.11.0/LICENSE.txt))
- go.uber.org/zap ([MIT](https://github.com/uber-go/zap/blob/v1.27.0/LICENSE))
- gocloud.dev ([Apache-2.0](https://github.com/google/go-cloud/blob/v0.26.0/LICENSE))
- golang.org/x/crypto ([BSD-3-Clause](https://cs.opensource.google/go/x/crypto/+/v0.21.0:LICENSE))
- golang.org/x/exp ([BSD-3-Clause](https://cs.opensource.google/go/x/exp/+/a685a6ed:LICENSE))
- golang.org/x/net ([BSD-3-Clause](https://cs.opensource.google/go/x/net/+/v0.22.0:LICENSE))
- golang.org/x/sync/errgroup ([BSD-3-Clause](https://cs.opensource.google/go/x/sync/+/v0.6.0:LICENSE))
- golang.org/x/sys ([BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/v0.18.0:LICENSE))
- golang.org/x/term ([BSD-3-Clause](https://cs.opensource.google/go/x/term/+/v0.18.0:LICENSE))
- golang.org/x/text ([BSD-3-Clause](https://cs.opensource.google/go/x/text/+/v0.14.0:LICENSE))
- golang.org/x/xerrors ([BSD-3-Clause](https://cs.opensource.google/go/x/xerrors/+/04be3eba:LICENSE))
- google.golang.org/api/googleapi ([BSD-3-Clause](https://github.com/googleapis/google-api-go-client/blob/v0.132.0/LICENSE))
- google.golang.org/api/internal/third_party/uritemplates ([BSD-3-Clause](https://github.com/googleapis/google-api-go-client/blob/v0.132.0/internal/third_party/uritemplates/LICENSE))
- google.golang.org/genproto/googleapis/api/httpbody ([Apache-2.0](https://github.com/googleapis/go-genproto/blob/bbf56f31fb17/googleapis/api/LICENSE))
- google.golang.org/genproto/googleapis/rpc ([Apache-2.0](https://github.com/googleapis/go-genproto/blob/3a041ad873d4/googleapis/rpc/LICENSE))
- google.golang.org/genproto/protobuf/field_mask ([Apache-2.0](https://github.com/googleapis/go-genproto/blob/83a465c0220f/LICENSE))
- google.golang.org/grpc ([Apache-2.0](https://github.com/grpc/grpc-go/blob/v1.59.0/LICENSE))
- google.golang.org/protobuf ([BSD-3-Clause](https://github.com/protocolbuffers/protobuf-go/blob/v1.33.0/LICENSE))
- gopkg.in/ini.v1 ([Apache-2.0](https://github.com/go-ini/ini/blob/v1.67.0/LICENSE))
- gopkg.in/natefinch/lumberjack.v2 ([MIT](https://github.com/natefinch/lumberjack/blob/v2.2.1/LICENSE))
- gopkg.in/olahol/melody.v1 ([BSD-2-Clause](https://github.com/olahol/melody/blob/d52139073376/LICENSE))
- gopkg.in/sourcemap.v1 ([BSD-2-Clause](https://github.com/go-sourcemap/sourcemap/blob/v1.0.5/LICENSE))
- gopkg.in/square/go-jose.v2 ([Apache-2.0](https://github.com/square/go-jose/blob/v2.6.0/LICENSE))
- gopkg.in/square/go-jose.v2/json ([BSD-3-Clause](https://github.com/square/go-jose/blob/v2.6.0/json/LICENSE))
- gopkg.in/yaml.v2 ([Apache-2.0](https://github.com/go-yaml/yaml/blob/v2.4.0/LICENSE))
- gopkg.in/yaml.v3 ([MIT](https://github.com/go-yaml/yaml/blob/v3.0.1/LICENSE))
- k8s.io/apimachinery/pkg/util ([Apache-2.0](https://github.com/kubernetes/apimachinery/blob/v0.25.0/LICENSE))
- k8s.io/klog/v2 ([Apache-2.0](https://github.com/kubernetes/klog/blob/v2.80.1/LICENSE))
- k8s.io/utils/internal/third_party/forked/golang/net ([BSD-3-Clause](https://github.com/kubernetes/utils/blob/e9cbc92d1a73/internal/third_party/forked/golang/LICENSE))
- k8s.io/utils/net ([Apache-2.0](https://github.com/kubernetes/utils/blob/e9cbc92d1a73/LICENSE))
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ xgowinnoui:
clean:
rm -f cells-sync*
rm -f rsrc.syso

licenses:
go-licenses report . --template ${GOPATH}/src/github.com/google/go-licenses/testdata/modules/hello01/licenses.tpl > DEPENDENCIES
62 changes: 51 additions & 11 deletions config/oidc-authorities.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import (
"sync"
"time"

"gopkg.in/square/go-jose.v2/jwt"
jose "github.com/go-jose/go-jose/v4"

Check failure on line 34 in config/oidc-authorities.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/go-jose/go-jose/v4; to add it:
"github.com/go-jose/go-jose/v4/jwt"

Check failure on line 35 in config/oidc-authorities.go

View workflow job for this annotation

GitHub Actions / build

no required module provides package github.com/go-jose/go-jose/v4/jwt; to add it:
"go.uber.org/zap"

"github.com/pydio/cells/v4/common/log"
servicecontext "github.com/pydio/cells/v4/common/service/context"
Expand Down Expand Up @@ -165,16 +167,54 @@ func (a *Authority) LoadInfo() {
}
}
// decode JWT token without verifying the signature
if a.IdToken != "" {
token, _ := jwt.ParseSigned(a.IdToken)
var claims map[string]interface{} // generic map to store parsed token
_ = token.UnsafeClaimsWithoutVerification(&claims)
if name, ok := claims["name"]; ok {
a.Username = name.(string)
}
parsed, _ := url.Parse(a.URI)
parsed.User = url.User(a.Username)
a.Id = parsed.String()
if a.IdToken == "" {
return
}

parsed, _ := url.Parse(a.URI)
parsed.User = url.User(a.Username)
a.Id = parsed.String()

if username, er := a.TokenToUsername(a.IdToken); er != nil {
log.Logger(oidcContext).Error("Cannot parse JWT token to extract current user id", zap.Error(er))
a.Username = "username-not-found"
} else {
a.Username = username
}
}

func (a *Authority) TokenToUsername(idToken string) (string, error) {

allSignatureAlgorithms := []jose.SignatureAlgorithm{
jose.EdDSA,
jose.HS256,
jose.HS384,
jose.HS512,
jose.RS256,
jose.RS384,
jose.RS512,
jose.ES256,
jose.ES384,
jose.ES512,
jose.PS256,
jose.PS384,
jose.PS512,
}

token, er := jwt.ParseSigned(idToken, allSignatureAlgorithms)
if er != nil {
return "", fmt.Errorf("cannot parse JWT token to extract current user id: %v", er)
}

var claims map[string]interface{} // generic map to store parsed token
if er := token.UnsafeClaimsWithoutVerification(&claims); er != nil {
return "", fmt.Errorf("cannot parse JWT token to extract current user id: %v", er)
}

if name, ok := claims["name"]; ok {
return name.(string), nil
} else {
return "", fmt.Errorf("cannot find name in claims")
}
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
google.golang.org/protobuf v1.34.2
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376
gopkg.in/square/go-jose.v2 v2.6.0
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ github.com/go-gorp/gorp/v3 v3.0.2/go.mod h1:BJ3q1ejpV8cVALtcXvXaXyTOlMmJhWDxTmnc
github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs=
github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw=
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-jose/go-jose/v4 v4.0.2 h1:R3l3kkBds16bO7ZFAEEcofK0MkrAJt3jlJznWZG0nvk=
github.com/go-jose/go-jose/v4 v4.0.2/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down

0 comments on commit 4d56696

Please sign in to comment.