language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
Go
hydra/cmd/serve_all.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cmd import ( "github.com/spf13/cobra" "github.com/ory/hydra/v2/driver" "github.com/ory/x/configx" "github.com/ory/x/servicelocatorx" "github.com/ory/hydra/v2/cmd/server" ) // allCmd represents the all command func NewServeAllCmd(slOp...
Go
hydra/cmd/serve_public.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cmd import ( "github.com/spf13/cobra" "github.com/ory/hydra/v2/driver" "github.com/ory/x/configx" "github.com/ory/x/servicelocatorx" "github.com/ory/hydra/v2/cmd/server" ) // servePublicCmd represents the public command func NewServe...
Go
hydra/cmd/version.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cmd import ( "fmt" "github.com/ory/hydra/v2/driver/config" "github.com/spf13/cobra" ) // versionCmd represents the version command func NewVersionCmd() *cobra.Command { return &cobra.Command{ Use: "version", Short: "Display this...
JSON
hydra/cmd/.snapshots/TestCreateClient-case=creates_successfully.json
{ "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "grant_types": [ "authorization_code" ], "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "request_object_signing_alg": "RS256", "response_types": [ "code" ], "scope": "offline_access offl...
JSON
hydra/cmd/.snapshots/TestCreateClient-case=supports_encryption.json
{ "audience": [ "https://www.ory.sh/audience1", "https://www.ory.sh/audience2" ], "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "grant_types": [ "authorization_code" ], "jwks": {}, "logo_uri": "", "metadata": { "foo": "bar" }, "owner": "", "policy_uri": ""...
JSON
hydra/cmd/.snapshots/TestCreateClient-case=supports_setting_flags.json
{ "audience": [ "https://www.ory.sh/audience1", "https://www.ory.sh/audience2" ], "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "grant_types": [ "authorization_code" ], "jwks": {}, "logo_uri": "", "metadata": { "foo": "bar" }, "owner": "", "policy_uri": ""...
JSON
hydra/cmd/.snapshots/TestDeleteClient-case=one_client_deletion_fails.json
"{\n \"error\": \"Unable to locate the resource\",\n \"error_description\": \"\"\n}\nFailed to execute API request, see error above.\ni-do-not-exist: this error should never be printed\n"
JSON
hydra/cmd/.snapshots/TestGetClient-case=gets_client.json
{ "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "scope": "", "skip_consent": false, "subject_type": "", "token_endpoint_auth_method": "client_secret_post", "tos_uri": "" }
JSON
hydra/cmd/.snapshots/TestGetClient-case=gets_multiple_clients.json
[ { "allowed_cors_origins": [], "audience": [], "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "contacts": [], "grant_types": [], "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "redirect_uris": [], "response_types...
JSON
hydra/cmd/.snapshots/TestImportClient-case=imports_clients_from_single_file.json
[ { "allowed_cors_origins": [], "audience": [], "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "scope": "foo", "skip_consent": false, "subject_type": "public", "token...
JSON
hydra/cmd/.snapshots/TestImportClient-case=performs_appropriate_error_reporting.json
[ { "allowed_cors_origins": [], "audience": [], "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "scope": "foo", "skip_consent": false, "subject_type": "public", "token...
JSON
hydra/cmd/.snapshots/TestImportJWKS-case=imports_JWK_key_from_STDIN.json
{ "keys": [ { "alg": "RS256", "d": "GtgNgOZeibUHNRI8TWz-KG-3VCGoDyeafmL9pR5mRz1eh9bsZSqrjOXA_EoS0pEvQgdjsXDWzSGGEJcsDS4TsXc6IyDuVHVw6bk0jqRnzePILHGtHHUNRI7afFCi1-E-wMxtoOLJLhbES2zRynZJgmF1h3-NMf24N-a34MbBA3smLGKjUOPe_AHuSsNj6Z2t7hIVjsZuT1XGQOAuAIsyirnab7Bi58_wJOCkoWkxvb_ImtsuG4nFhmsnep3-hij_3WTq_vGUEo...
JSON
hydra/cmd/.snapshots/TestRevokeToken-case=revokes_valid_token_but_without_client_credentials.json
"Usage:\n token the-token [flags]\n\nExamples:\n{{ .CommandPath }} --client-id a0184d6c-b313-4e70-a0b9-905b581e9218 --client-secret Hh1BjioNNm ciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNT\n\nFlags:\n --client-id string Use the provided OAuth 2.0 Client ID, de...
JSON
hydra/cmd/.snapshots/TestUpdateClient-case=creates_successfully.json
{ "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "grant_types": [ "implicit" ], "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "request_object_signing_alg": "RS256", "response_types": [ "code" ], "scope": "offline_access offline openid...
JSON
hydra/cmd/.snapshots/TestUpdateClient-case=supports_encryption.json
{ "client_name": "", "client_secret_expires_at": 0, "client_uri": "", "grant_types": [ "implicit" ], "jwks": {}, "logo_uri": "", "metadata": {}, "owner": "", "policy_uri": "", "request_object_signing_alg": "RS256", "response_types": [ "code" ], "scope": "offline_access offline openid...
Go
hydra/cmd/cli/error.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "bytes" "encoding/json" ) func FormatSwaggerError(err error) string { if err == nil { return "" } var b bytes.Buffer if err := json.NewEncoder(&b).Encode(err); err != nil { panic(err) } var e struct { Payload js...
Go
hydra/cmd/cli/handler.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "github.com/ory/hydra/v2/driver" "github.com/ory/x/configx" "github.com/ory/x/servicelocatorx" ) type Handler struct { Migration *MigrateHandler Janitor *JanitorHandler } func NewHandler(slOpts []servicelocatorx.Option,...
Go
hydra/cmd/cli/handler_helper.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "net/http" "github.com/sawadashota/encrypta" "github.com/spf13/cobra" "github.com/ory/x/flagx" ) const ( FlagEncryptionPGPKey = "pgp-key" FlagEncryptionPGPKeyURL = "pgp-key-url" FlagEncryptionKeybase = "keybase" )...
Go
hydra/cmd/cli/handler_janitor.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "context" "fmt" "io" "time" "github.com/ory/x/servicelocatorx" "github.com/ory/hydra/v2/persistence" "github.com/pkg/errors" "github.com/ory/x/flagx" "github.com/spf13/cobra" "github.com/ory/hydra/v2/driver" "gi...
Go
hydra/cmd/cli/handler_janitor_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli_test import ( "context" "fmt" "testing" "time" "github.com/ory/hydra/v2/cmd" "github.com/spf13/cobra" "github.com/stretchr/testify/require" "github.com/ory/hydra/v2/cmd/cli" "github.com/ory/hydra/v2/internal/testhelpers" "g...
Go
hydra/cmd/cli/handler_jwk.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( jose "github.com/go-jose/go-jose/v3" ) func ToSDKFriendlyJSONWebKey(key interface{}, kid, use string) jose.JSONWebKey { var alg string if jwk, ok := key.(*jose.JSONWebKey); ok { key = jwk.Key if jwk.KeyID != "" { kid...
Go
hydra/cmd/cli/handler_jwk_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "testing" "github.com/ory/x/josex" ) func Test_toSDKFriendlyJSONWebKey(t *testing.T) { publicJWK := []byte(`{ "kty": "RSA", "e": "AQAB", "use": "sig", "kid": "7a5ff76a-6766-11ea-bc55-0242ac130003", "alg": "RS256",...
Go
hydra/cmd/cli/handler_migrate.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cli import ( "bytes" "context" "fmt" "io" "io/fs" "os" "path/filepath" "regexp" "strings" "time" "github.com/ory/x/popx" "github.com/ory/x/servicelocatorx" "github.com/pkg/errors" "github.com/ory/x/configx" "github.com/ory...
Go
hydra/cmd/cliclient/client.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package cliclient import ( "net/url" "github.com/pkg/errors" "github.com/ory/x/cmdx" "github.com/spf13/cobra" hydra "github.com/ory/hydra-client-go/v2" ) type ContextKey int const ( ClientContextKey ContextKey = iota + 1 OAuth2URLOverri...
Go
hydra/cmd/clidoc/main.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package main import ( "fmt" "os" "github.com/ory/x/clidoc" "github.com/ory/hydra/v2/cmd" ) func main() { if err := clidoc.Generate(cmd.NewRootCmd(nil, nil, nil), os.Args[1:]); err != nil { _, _ = fmt.Fprintf(os.Stderr, "%+v", err) os.Exi...
Go
hydra/cmd/server/banner.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package server func banner(version string) string { return `Thank you for using Ory Hydra ` + version + `! Take security seriously and subscribe to the Ory Security Newsletter. Stay on top of new patches and security insights. >> Subscribe now: h...
Go
hydra/cmd/server/handler.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package server import ( "context" "crypto/tls" "fmt" "net/http" "strings" "sync" "time" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "github.com/ory/x/otelx/semconv" "github.com/ory/x/servicelocatorx" "github.com/or...
Go
hydra/cmd/server/helper_cert.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package server import ( "context" "crypto/sha1" // #nosec G505 - This is required for certificate chains alongside sha256 "crypto/sha256" "crypto/tls" "crypto/x509" "encoding/pem" "sync" "github.com/gofrs/uuid" "github.com/go-jose/go-jose...
Go
hydra/cmd/server/helper_cert_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package server_test import ( "bytes" "context" "crypto/x509" "encoding/base64" "encoding/json" "os" "testing" "time" "github.com/go-jose/go-jose/v3" "github.com/google/uuid" "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/t...
hydra/cmd/stub/ecdh.key
-----BEGIN EC PRIVATE KEY----- MIGkAgEBBDDvoj/bM1HokUjYWO/IDFs26Jo0GIFtU3tMQQu7ZabKscDMK3dZA0mK v97ij7BBFbCgBwYFK4EEACKhZANiAAT3KhQQCDFN32y/B72g+qOFw/5/aNx1MvZa rwDDa/2G3V0HLTS0VE82sLEUKS8xwkWFI+gNRXk0vvN+Hf+myJI1jOIY+tYQlh+C ZiKGNJ6g5/Su7V6ukGtN+UiY+sx+0LI= -----END EC PRIVATE KEY-----
hydra/cmd/stub/ecdh.pub
-----BEGIN PUBLIC KEY----- MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE9yoUEAgxTd9svwe9oPqjhcP+f2jcdTL2 Wq8Aw2v9ht1dBy00tFRPNrCxFCkvMcJFhSPoDUV5NL7zfh3/psiSNYziGPrWEJYf gmYihjSeoOf0ru1erpBrTflImPrMftCy -----END PUBLIC KEY-----
JSON
hydra/cmd/stub/jwk.json
{ "kty": "RSA", "n": "slWybuiNYR7uOgKuvaBwqVk8saEutKhOAaW-3hWF65gJei-ZV8QFfYDxs9ZaRZlWAUMtncQPnw7ZQlXO9ogN5cMcN50C6qMOOZzghK7danalhF5lUETC4Hk3Eisbi_PR3IfVyXaRmqL6X66MKj_JAKyD9NFIDVy52K8A198Jojnrw2-XXQW72U68fZtvlyl_BTBWQ9Re5JSTpEcVmpCR8FrFc0RPMBm-G5dRs08vvhZNiTT2JACO5V-J5ZrgP3s5hnGFcQFZgDnXLInDUdoi1MuCjaAU0ta8_08pHM...
hydra/cmd/stub/pgp.key
-----BEGIN PGP PRIVATE KEY BLOCK----- lQPGBFycM3oBCADUSXgKFJJMXeZbmaYhhK7Ky364MhyBDvh+J8rFdyIC2q4CNzsw e9q+PnOEXuCYlkrtrlHkzaxRUHcva9zFC3zUbKxCa/ErfPFQD6iBheE2L2/Ihp4Z 0PMKIFJM90LRqqa3VqItfleHwT6BUp21mTzq0dZLDUAv36P8IX/N+cMTxxbUuql2 oGZ3AlzPpwwnyOif/vgYEbcK0CcwVO4+jVXQ0xEx6KArv7XZtTcFqF6YslCNVcd2 R6YcAj1DDrIGX2GgacXYl...
hydra/cmd/stub/pgp.pub
-----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFycM3oBCADUSXgKFJJMXeZbmaYhhK7Ky364MhyBDvh+J8rFdyIC2q4CNzsw e9q+PnOEXuCYlkrtrlHkzaxRUHcva9zFC3zUbKxCa/ErfPFQD6iBheE2L2/Ihp4Z 0PMKIFJM90LRqqa3VqItfleHwT6BUp21mTzq0dZLDUAv36P8IX/N+cMTxxbUuql2 oGZ3AlzPpwwnyOif/vgYEbcK0CcwVO4+jVXQ0xEx6KArv7XZtTcFqF6YslCNVcd2 R6YcAj1DDrIGX2GgacXYlG...
hydra/cmd/stub/rsa.key
-----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEAslWybuiNYR7uOgKuvaBwqVk8saEutKhOAaW+3hWF65gJei+Z V8QFfYDxs9ZaRZlWAUMtncQPnw7ZQlXO9ogN5cMcN50C6qMOOZzghK7danalhF5l UETC4Hk3Eisbi/PR3IfVyXaRmqL6X66MKj/JAKyD9NFIDVy52K8A198Jojnrw2+X XQW72U68fZtvlyl/BTBWQ9Re5JSTpEcVmpCR8FrFc0RPMBm+G5dRs08vvhZNiTT2 JACO5V+J5ZrgP3s5hnGFcQFZgDnX...
hydra/cmd/stub/rsa.pub
-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAslWybuiNYR7uOgKuvaBw qVk8saEutKhOAaW+3hWF65gJei+ZV8QFfYDxs9ZaRZlWAUMtncQPnw7ZQlXO9ogN 5cMcN50C6qMOOZzghK7danalhF5lUETC4Hk3Eisbi/PR3IfVyXaRmqL6X66MKj/J AKyD9NFIDVy52K8A198Jojnrw2+XXQW72U68fZtvlyl/BTBWQ9Re5JSTpEcVmpCR 8FrFc0RPMBm+G5dRs08vvhZNiTT2JACO5...
JSON
hydra/cmd/test/another_public_key.json
{ "kty": "RSA", "e": "AQAB", "use": "sig", "kid": "public:8a5ff76a-6766-11ea-bc55-0242ac130003S", "alg": "RS256", "n": "l80jJJqcc1PpefIGVIjuPvA1D7NscnuF9aQqLa7I9rDUK4IaSOO3kL_EF13k-jTzcA5q4OZn5dR0kmqIMZT2gQ" }
JSON
hydra/cmd/test/private_key.json
{ "kty": "RSA", "e": "AQAB", "use": "sig", "kid": "private:7a5ff76a-6766-11ea-bc55-0242ac130003S", "alg": "RS256", "n": "l80jJJqcc1PpefIGVIjuPvA1D7NscnuF9aQqLa7I9rDUK4IaSOO3kL_EF13k-jTzcA5q4OZn5dR0kmqIMZT2gQ" }
JSON
hydra/cmd/test/public_key.json
{ "kty": "RSA", "e": "AQAB", "use": "sig", "kid": "public:7a5ff76a-6766-11ea-bc55-0242ac130003S", "alg": "RS256", "n": "l80jJJqcc1PpefIGVIjuPvA1D7NscnuF9aQqLa7I9rDUK4IaSOO3kL_EF13k-jTzcA5q4OZn5dR0kmqIMZT2gQ" }
Go
hydra/consent/handler.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "encoding/json" "net/http" "net/url" "time" "github.com/ory/hydra/v2/flow" "github.com/ory/hydra/v2/oauth2/flowctx" "github.com/ory/hydra/v2/x/events" "github.com/ory/x/pagination/tokenpagination" "github.com/ory/...
Go
hydra/consent/handler_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent_test import ( "bytes" "context" "encoding/json" "fmt" "net/http" "net/http/httptest" "testing" "time" "github.com/stretchr/testify/require" hydra "github.com/ory/hydra-client-go/v2" "github.com/ory/hydra/v2/client" . "g...
Go
hydra/consent/helper.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "net/http" "strings" "time" "github.com/ory/hydra/v2/flow" "github.com/ory/hydra/v2/x" "github.com/ory/x/errorsx" "github.com/gorilla/sessions" "github.com/ory/fosite" "github.com/ory/x/mapx" "github.com/ory/h...
Go
hydra/consent/helper_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "fmt" "net/http" "net/http/httptest" "testing" "time" "github.com/golang/mock/gomock" "github.com/ory/hydra/v2/flow" "github.com/ory/hydra/v2/internal/mock" "github.com/gorilla/securecookie" "github.com/gorilla/...
Go
hydra/consent/janitor_consent_test_helper.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "time" "github.com/ory/hydra/v2/flow" "github.com/ory/x/sqlxx" ) func NewHandledLoginRequest(challenge string, hasError bool, requestedAt time.Time, authenticatedAt sqlxx.NullTime) *flow.HandledLoginRequest { var denie...
Go
hydra/consent/manager.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "context" "time" "github.com/gofrs/uuid" "github.com/ory/hydra/v2/client" "github.com/ory/hydra/v2/flow" ) type ForcedObfuscatedLoginSession struct { ClientID string `db:"client_id"` Subject s...
Go
hydra/consent/manager_test_helpers.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "context" "errors" "fmt" "testing" "time" "github.com/ory/hydra/v2/aead" "github.com/ory/hydra/v2/flow" "github.com/ory/x/assertx" "github.com/ory/x/contextx" gofrsuuid "github.com/gofrs/uuid" "github.com/google...
Go
hydra/consent/registry.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "context" "github.com/ory/fosite/handler/openid" "github.com/ory/hydra/v2/aead" "github.com/ory/hydra/v2/client" "github.com/ory/hydra/v2/internal/kratos" "github.com/ory/hydra/v2/x" ) type InternalRegistry interface...
Go
hydra/consent/sdk_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent_test import ( "context" "fmt" "net/http" "net/http/httptest" "testing" "time" hydra "github.com/ory/hydra-client-go/v2" . "github.com/ory/hydra/v2/flow" "github.com/ory/x/httprouterx" "github.com/stretchr/testify/assert"...
Go
hydra/consent/strategy.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "context" "net/http" "github.com/ory/fosite" "github.com/ory/hydra/v2/flow" ) var _ Strategy = new(DefaultStrategy) type Strategy interface { HandleOAuth2AuthorizationRequest( ctx context.Context, w http.Response...
Go
hydra/consent/strategy_default.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "context" "fmt" "net/http" "net/url" "strconv" "strings" "time" "github.com/gorilla/sessions" "github.com/hashicorp/go-retryablehttp" "github.com/pborman/uuid" "github.com/pkg/errors" "github.com/sirupsen/logrus...
Go
hydra/consent/strategy_default_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent_test import ( "context" "net/http" "net/http/cookiejar" "net/http/httptest" "net/url" "testing" "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/tidwall/gjson" "github.com/ory/fosite/token/jwt" ...
Go
hydra/consent/strategy_logout_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent_test import ( "bytes" "context" "encoding/json" "fmt" "net/http" "net/http/httptest" "net/url" "strings" "sync" "testing" "time" "github.com/ory/hydra/v2/internal/kratos" "github.com/ory/x/pointerx" "github.com/stretc...
Go
hydra/consent/strategy_oauth_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent_test import ( "bytes" "context" "crypto/sha256" "encoding/json" "fmt" "net/http" "net/http/cookiejar" "net/url" "regexp" "testing" "time" "github.com/ory/hydra/v2/aead" "github.com/ory/hydra/v2/consent" "github.com/ory...
Go
hydra/consent/subject_identifier_algorithm.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import "github.com/ory/hydra/v2/client" type SubjectIdentifierAlgorithm interface { // Obfuscate derives a pairwise subject identifier from the given string. Obfuscate(subject string, client *client.Client) (string, error) }
Go
hydra/consent/subject_identifier_algorithm_pairwise.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import ( "crypto/sha256" "fmt" "net/url" "github.com/ory/x/errorsx" "github.com/ory/fosite" "github.com/ory/hydra/v2/client" ) type SubjectIdentifierAlgorithmPairwise struct { Salt []byte } func NewSubjectIdentifierAlgorit...
Go
hydra/consent/subject_identifier_algorithm_public.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package consent import "github.com/ory/hydra/v2/client" type SubjectIdentifierAlgorithmPublic struct{} func NewSubjectIdentifierAlgorithmPublic() *SubjectIdentifierAlgorithmPublic { return &SubjectIdentifierAlgorithmPublic{} } func (g *SubjectId...
YAML
hydra/contrib/quickstart/quickstart-gitlab.yml
version: "3" services: gitlab: image: gitlab/gitlab-ce:13.3.2-ce.0 restart: always hostname: gitlab.example.com environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://gitlab.example.com:8000/' ports: - "443:443" # https - "8000:8000" # http - "2222:22" # ssh ...
YAML
hydra/contrib/quickstart/5-min/hydra.yml
serve: cookies: same_site_mode: Lax urls: self: issuer: http://127.0.0.1:4444 consent: http://127.0.0.1:3000/consent login: http://127.0.0.1:3000/login logout: http://127.0.0.1:3000/logout secrets: system: - youReallyNeedToChangeThis oidc: subject_identifiers: supported_types: - p...
Ruby
hydra/contrib/quickstart/gitlab/config/gitlab.rb
# Copyright © 2022 Ory Corp # SPDX-License-Identifier: Apache-2.0 ## GitLab configuration settings ##! This file is generated during initial installation and **is not** modified ##! during upgrades. ##! Check out the latest version of this file to know about the different ##! settings that can be configured by this fi...
JSON
hydra/cypress/fixtures/example.json
{ "name": "Using fixtures to represent data", "email": "hello@cypress.io", "body": "Fixtures are a great way to mock data for responses to routes" }
JavaScript
hydra/cypress/helpers/index.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { v4 as uuidv4 } from "uuid" export const prng = () => uuidv4() const isStatusOk = (res) => res.ok ? Promise.resolve(res) : Promise.reject( new Error(`Received unexpected status code ${res.statusCode}`), ) export con...
JavaScript
hydra/cypress/integration/admin/client_create.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" describe("The Clients Admin Interface", function () { const nc = () => ({ scope: "foo openid offline_access", grant_types: ["client_credentials"], }) it("should return client_secret with length 26 ...
JavaScript
hydra/cypress/integration/admin/grant_jwtbearer.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 const dayjs = require("dayjs") const isBetween = require("dayjs/plugin/isBetween") const utc = require("dayjs/plugin/utc") dayjs.extend(utc) dayjs.extend(isBetween) describe("The JWT-Bearer Grants Admin Interface", () => { let d = dayjs().utc().ad...
JavaScript
hydra/cypress/integration/oauth2/authorize_code.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("The OAuth 2.0 Authorization Code Grant", function () { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" +...
JavaScript
hydra/cypress/integration/oauth2/authorize_error.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" import qs from "querystring" const accessTokenStrategies = ["opaque", "jwt"] describe("OAuth 2.0 Authorization Endpoint Error Handling", () => { accessTokenStrategies.forEach((accessTokenStrategy...
JavaScript
hydra/cypress/integration/oauth2/client_creds.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("The OAuth 2.0 Authorization Code Grant", function () { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_toke...
JavaScript
hydra/cypress/integration/oauth2/consent.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OAuth 2.0 End-User Authorization", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy="...
JavaScript
hydra/cypress/integration/oauth2/grant_jwtbearer.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, createGrant, deleteClients, deleteGrants, prng, } from "../../helpers" const dayjs = require("dayjs") const isBetween = require("dayjs/plugin/isBetween") const utc = require("dayjs/plugin/utc") dayjs.extend(utc) dayj...
JavaScript
hydra/cypress/integration/oauth2/introspect.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OpenID Connect Token Introspection", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" + accessTok...
JavaScript
hydra/cypress/integration/oauth2/jwt.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OAuth 2.0 JSON Web Token Access Tokens", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_stra...
JavaScript
hydra/cypress/integration/oauth2/refresh_token.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("The OAuth 2.0 Refresh Token Grant", function () { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_str...
JavaScript
hydra/cypress/integration/openid/authorize_code.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OpenID Connect Authorize Code Grant", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" + accessTo...
JavaScript
hydra/cypress/integration/openid/dynamic_client_registration.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 describe("OAuth2 / OpenID Connect Dynamic Client Registration", function () { it("should return same client_secret given in request for newly created clients with client_secret specified", function () { cy.request({ method: "POST", ...
JavaScript
hydra/cypress/integration/openid/logout.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { deleteClients, prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" + accessTokenStrategy, function () { const nc = () ...
JavaScript
hydra/cypress/integration/openid/prompt.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { createClient, prng } from "../../helpers" import qs from "querystring" const accessTokenStrategies = ["opaque", "jwt"] describe("OpenID Connect Prompt", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("acces...
JavaScript
hydra/cypress/integration/openid/revoke.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OpenID Connect Token Revokation", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" + accessTokenS...
JavaScript
hydra/cypress/integration/openid/userinfo.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 import { prng } from "../../helpers" const accessTokenStrategies = ["opaque", "jwt"] describe("OpenID Connect Userinfo", () => { accessTokenStrategies.forEach((accessTokenStrategy) => { describe("access_token_strategy=" + accessTokenStrategy,...
JavaScript
hydra/cypress/plugins/index.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 // *********************************************************** // This example plugins/index.js can be used to load plugins // // You can change the location of this file or turn off loading // the plugins file with the 'pluginsFile' configuration op...
JavaScript
hydra/cypress/support/commands.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 // *********************************************** // This example commands.js shows you how to // create various custom commands and overwrite // existing commands. // // For more comprehensive examples of custom // commands please read more here: /...
JavaScript
hydra/cypress/support/index.js
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 // *********************************************************** // This example support/index.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and // behavior that modifies Cyp...
Markdown
hydra/docs/flow-cache-design-doc.md
# Flow Cache Design Doc ## Overview This design doc outlines the proposed solution for caching the flow object in the OAuth2 exchange between the Client, Ory Hydra, and the Consent and Login UIs. The flow object contains the state of the authorization request. ## Problem Statement Currently, the flow object is stor...
Markdown
hydra/docs/README.md
# Documentation Please find the documentation at [www.ory.sh/docs/hydra](https://www.ory.sh/docs/hydra). To contribute to the documentation, please head over to: [github.com/ory/docs/tree/master/docs/hydra](https://github.com/ory/docs/tree/master/docs/hydra)
Go
hydra/driver/factory.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "io/fs" "github.com/ory/hydra/v2/driver/config" "github.com/ory/x/configx" "github.com/ory/x/logrusx" "github.com/ory/x/otelx" "github.com/ory/x/popx" "github.com/ory/x/servicelocatorx" ) type ( options s...
Go
hydra/driver/registry.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "io/fs" "net/http" "go.opentelemetry.io/otel/trace" "github.com/ory/hydra/v2/internal/kratos" "github.com/ory/x/httprouterx" "github.com/ory/x/popx" "github.com/ory/hydra/v2/aead" "github.com/ory/hydra/v...
Go
hydra/driver/registry_base.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "crypto/sha256" "fmt" "net/http" "time" "github.com/gorilla/sessions" "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/...
Go
hydra/driver/registry_base_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "errors" "fmt" "io" "net/http" "net/http/httptest" "testing" "github.com/ory/x/randx" "github.com/stretchr/testify/require" "github.com/ory/x/httpx" "github.com/sirupsen/logrus" "github.com/sirupsen/...
Go
hydra/driver/registry_nosqlite.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 //go:build !sqlite // +build !sqlite package driver func (m *RegistrySQL) CanHandle(dsn string) bool { return m.alwaysCanHandle(dsn) }
Go
hydra/driver/registry_sql.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "io/fs" "strings" "time" "github.com/gobuffalo/pop/v6" _ "github.com/jackc/pgx/v4/stdlib" "github.com/luna-duclos/instrumentedsql" "github.com/ory/hydra/v2/client" "github.com/ory/hydra/v2/consent" "gith...
Go
hydra/driver/registry_sqlite.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 //go:build sqlite // +build sqlite package driver import ( "strings" ) func (m *RegistrySQL) CanHandle(dsn string) bool { scheme := strings.Split(dsn, "://")[0] return scheme == "sqlite" || scheme == "sqlite3" || m.alwaysCanHandle(dsn) }
Go
hydra/driver/registry_sql_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package driver import ( "context" "math/rand" "strconv" "testing" "github.com/stretchr/testify/require" "github.com/stretchr/testify/assert" "github.com/ory/hydra/v2/client" "github.com/ory/hydra/v2/driver/config" "github.com/ory/hydra/v...
Go
hydra/driver/config/buildinfo.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config var ( Version = "master" Date = "undefined" Commit = "undefined" )
Go
hydra/driver/config/config.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config type Provider interface { Config() *DefaultProvider }
Go
hydra/driver/config/helper.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "net/url" "github.com/pkg/errors" "github.com/ory/x/logrusx" ) func Validate(ctx context.Context, l *logrusx.Logger, p *DefaultProvider) error { if p.IssuerURL(ctx).String() == "" && !p.IsDevelopmentMode(ctx...
Go
hydra/driver/config/provider.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "fmt" "net/http" "net/url" "strings" "time" "github.com/pkg/errors" "github.com/ory/x/hasherx" "github.com/gofrs/uuid" "github.com/ory/x/otelx" "github.com/ory/hydra/v2/spec" "github.com/ory/x/dbal"...
Go
hydra/driver/config/provider_fosite.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "strings" "time" "github.com/pkg/errors" "github.com/ory/fosite" "github.com/ory/fosite/token/jwt" "github.com/ory/hydra/v2/x" ) var _ fosite.GlobalSecretProvider = (*DefaultProvider)(nil) func (p *Defaul...
Go
hydra/driver/config/provider_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "fmt" "io" "net/http" "net/url" "os" "strings" "testing" "time" "github.com/ory/fosite/token/jwt" "github.com/ory/x/configx" "github.com/ory/x/otelx" "github.com/rs/cors" "github.com/stretchr/testify...
Go
hydra/driver/config/serve.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "fmt" "os" "strings" "github.com/ory/x/contextx" "github.com/rs/cors" "github.com/ory/x/configx" ) const ( KeySuffixListenOnHost = "host" KeySuffixListenOnPort = "port" KeySuffixSoc...
Go
hydra/driver/config/tls.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "context" "crypto/tls" "github.com/pkg/errors" "github.com/ory/x/logrusx" "github.com/ory/x/tlsx" ) const ( KeySuffixTLSEnabled = "tls.enabled" KeySuffixTLSAllowTerminationFrom = "tls.allow_termination_...
Go
hydra/driver/config/types.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "strings" "github.com/ory/x/stringsx" ) // AccessTokenStrategyType is the type of access token strategy. type AccessTokenStrategyType string const ( // AccessTokenJWTStrategy is the JWT access token strategy. AccessTok...
Go
hydra/driver/config/types_test.go
// Copyright © 2022 Ory Corp // SPDX-License-Identifier: Apache-2.0 package config import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestToAccessTokenStrategyType(t *testing.T) { actual, err := ToAccessTokenStrategyType("opaque") require.NoError(t, err) asse...