language stringlengths 0 24 | filename stringlengths 9 214 | code stringlengths 99 9.93M |
|---|---|---|
SQL | hydra/persistence/sql/migrations/20230606112801000001_remove_flow_indices.mysql.up.sql | DROP INDEX hydra_oauth2_flow_login_verifier_idx ON hydra_oauth2_flow;
DROP INDEX hydra_oauth2_flow_consent_verifier_idx ON hydra_oauth2_flow;
DROP INDEX hydra_oauth2_flow_multi_query_idx ON hydra_oauth2_flow;
CREATE INDEX hydra_oauth2_flow_previous_consents_idx
ON hydra_oauth2_flow (subject, client_id, nid, consent_... |
SQL | hydra/persistence/sql/migrations/20230606112801000001_remove_flow_indices.up.sql | DROP INDEX hydra_oauth2_flow_login_verifier_idx;
DROP INDEX hydra_oauth2_flow_consent_verifier_idx;
DROP INDEX hydra_oauth2_flow_multi_query_idx;
CREATE INDEX IF NOT EXISTS hydra_oauth2_flow_previous_consents_idx
ON hydra_oauth2_flow (subject, client_id, nid, consent_skip, consent_error, consent_remember); |
SQL | hydra/persistence/sql/migrations/20230809122501000001_add_kratos_session_id.down.sql | ALTER TABLE hydra_oauth2_flow DROP COLUMN identity_provider_session_id;
ALTER TABLE hydra_oauth2_authentication_session DROP COLUMN identity_provider_session_id; |
SQL | hydra/persistence/sql/migrations/20230809122501000001_add_kratos_session_id.up.sql | ALTER TABLE hydra_oauth2_flow ADD COLUMN identity_provider_session_id VARCHAR(40);
ALTER TABLE hydra_oauth2_authentication_session ADD COLUMN identity_provider_session_id VARCHAR(40); |
SQL | hydra/persistence/sql/src/20150101000001_networks/20150101000001000000_networks.cockroach.up.sql | CREATE TABLE "networks" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
INSERT INTO networks (id, created_at, updated_at) VALUES (gen_random_uuid(), '2013-10-07 08:23:19', '2013-10-07 08:23:19'); |
SQL | hydra/persistence/sql/src/20150101000001_networks/20150101000001000000_networks.mysql.up.sql | CREATE TABLE `networks` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
);
INSERT INTO networks (id, created_at, updated_at) VALUES ((SELECT LOWER(CONCAT(
HEX(RANDOM_BYTES(4)),
'-', HEX(RANDOM_BYTES(2)),
'-4', SUBSTR(HEX(RANDOM_BYTES(2)), ... |
SQL | hydra/persistence/sql/src/20150101000001_networks/20150101000001000000_networks.postgres.up.sql | CREATE TABLE "networks" (
"id" UUID NOT NULL,
PRIMARY KEY("id"),
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
INSERT INTO networks (id, created_at, updated_at) VALUES (uuid_in(
overlay(
overlay(
md5(random()::text || ':' || clock_timestamp()::text)
placing '4'
fro... |
SQL | hydra/persistence/sql/src/20150101000001_networks/20150101000001000000_networks.sqlite.up.sql | CREATE TABLE "networks" (
"id" TEXT PRIMARY KEY,
"created_at" DATETIME NOT NULL,
"updated_at" DATETIME NOT NULL
);
INSERT INTO networks (id, created_at, updated_at) VALUES (lower(
hex(randomblob(4)) ||
'-' || hex(randomblob(2)) ||
'-' || '4' || substr(hex(randomblob(2)), 2) ||
'-' || substr('AB89', 1 + (... |
SQL | hydra/persistence/sql/src/20211019000001_merge_authentication_request_tables/20211019000001000000_merge_authentication_request_tables.cockroach.up.sql | CREATE TABLE hydra_oauth2_flow
(
login_challenge character varying(40) NOT NULL,
requested_scope text NOT NULL DEFAULT '[]',
login_verifier character varying(40) NOT NULL,
login_csrf character varying(40) NOT NULL,
subject character var... |
SQL | hydra/persistence/sql/src/20211019000001_merge_authentication_request_tables/20211019000001000000_merge_authentication_request_tables.mysql.up.sql | CREATE TABLE hydra_oauth2_flow
(
`login_challenge` varchar(40) NOT NULL,
`requested_scope` text NOT NULL DEFAULT ('[]'),
`login_verifier` varchar(40) NOT NULL,
`login_csrf` varchar(40) NOT NULL,
`subject` varchar(255) NOT NULL,
`request_url` text NOT NULL,
`login_skip` tinyint(1) NOT NULL,
... |
SQL | hydra/persistence/sql/src/20211019000001_merge_authentication_request_tables/20211019000001000000_merge_authentication_request_tables.postgres.up.sql | CREATE TABLE hydra_oauth2_flow
(
login_challenge character varying(40) NOT NULL,
requested_scope text NOT NULL DEFAULT '[]',
login_verifier character varying(40) NOT NULL,
login_csrf character varying(40) NOT NULL,
subject character var... |
SQL | hydra/persistence/sql/src/20211019000001_merge_authentication_request_tables/20211019000001000000_merge_authentication_request_tables.sqlite.up.sql | CREATE TABLE hydra_oauth2_flow
(
login_challenge VARCHAR(40) NOT NULL PRIMARY KEY,
requested_scope TEXT NOT NULL DEFAULT '[]',
login_verifier VARCHAR(40) NOT NULL,
login_csrf VARCHAR(40) NOT NULL,
subject VARCHAR(255) NOT NUL... |
SQL | hydra/persistence/sql/src/20220210000001_nid/20220210000001000000_nid.cockroach.up.sql | -- hydra_client
ALTER TABLE hydra_client ADD COLUMN "nid" UUID;
ALTER TABLE hydra_client ADD CONSTRAINT "hydra_client_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "networks" ("id") ON UPDATE RESTRICT ON DELETE CASCADE;
--split
UPDATE hydra_client SET nid = (SELECT id FROM networks LIMIT 1);
--split
ALTER TABLE hydra_clie... |
SQL | hydra/persistence/sql/src/20220210000001_nid/20220210000001000000_nid.mysql.up.sql | -- Encode key_id in ascii as a workaround for the 3072-byte index entry size limit[1]
-- This is a breaking change for MySQL key IDs with utf-8 symbols higher than 127
-- [1]: https://dev.mysql.com/doc/refman/8.0/en/innodb-limits.html
ALTER TABLE hydra_oauth2_trusted_jwt_bearer_issuer DROP FOREIGN KEY `hydra_oauth2_tru... |
SQL | hydra/persistence/sql/src/20220210000001_nid/20220210000001000000_nid.postgres.up.sql | -- hydra_client
ALTER TABLE hydra_client ADD COLUMN nid UUID;
ALTER TABLE hydra_client ADD CONSTRAINT hydra_client_nid_fk_idx FOREIGN KEY (nid) REFERENCES networks (id) ON UPDATE RESTRICT ON DELETE CASCADE;
--split
UPDATE hydra_client SET nid = (SELECT id FROM networks LIMIT 1);
--split
ALTER TABLE hydra_client ALTER n... |
SQL | hydra/persistence/sql/src/20220210000001_nid/20220210000001000000_nid.sqlite.up.sql | -- hydra_oauth2_jti_blacklist
ALTER TABLE hydra_oauth2_jti_blacklist ADD COLUMN nid CHAR(36) NULL REFERENCES networks(id) ON DELETE CASCADE ON UPDATE RESTRICT;
UPDATE hydra_oauth2_jti_blacklist SET nid = (SELECT id FROM networks LIMIT 1);
CREATE TABLE "_hydra_oauth2_jti_blacklist_tmp" (
signature VARCHAR(64) NOT N... |
SQL | hydra/persistence/sql/src/20220513000001_string_slice_json/20220513000001000000_string_slice_json.cockroach.up.sql | ALTER TABLE hydra_client ADD COLUMN redirect_uris_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN grant_types_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN response_types_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN audience_json jsonb DEFAULT '[]' ... |
SQL | hydra/persistence/sql/src/20220513000001_string_slice_json/20220513000001000000_string_slice_json.mysql.up.sql | ALTER TABLE hydra_client ADD COLUMN redirect_uris_json json DEFAULT ('[]') NOT NULL;
ALTER TABLE hydra_client ADD COLUMN grant_types_json json DEFAULT ('[]') NOT NULL;
ALTER TABLE hydra_client ADD COLUMN response_types_json json DEFAULT ('[]') NOT NULL;
ALTER TABLE hydra_client ADD COLUMN audience_json json DEFAULT ('[... |
SQL | hydra/persistence/sql/src/20220513000001_string_slice_json/20220513000001000000_string_slice_json.postgres.up.sql | ALTER TABLE hydra_client ADD COLUMN redirect_uris_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN grant_types_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN response_types_json jsonb DEFAULT '[]' NOT NULL;
ALTER TABLE hydra_client ADD COLUMN audience_json jsonb DEFAULT '[]' ... |
SQL | hydra/persistence/sql/src/20220513000001_string_slice_json/20220513000001000000_string_slice_json.sqlite.up.sql | UPDATE hydra_client SET redirect_uris = '[]' WHERE redirect_uris = '';
UPDATE hydra_client SET grant_types = '[]' WHERE grant_types = '';
UPDATE hydra_client SET response_types = '[]' WHERE response_types = '';
UPDATE hydra_client SET audience = '[]' WHERE audience = '';
UPDATE hydra_client SET allowed_cors_origins = '... |
Shell Script | hydra/script/render-schemas.sh | #!/bin/sh
set -euxo pipefail
ory_x_version="$(go list -f '{{.Version}}' -m github.com/ory/x)"
sed "s!ory://tracing-config!https://raw.githubusercontent.com/ory/x/$ory_x_version/otelx/config.schema.json!g;" spec/config.json > .schema/config.schema.json
git commit --author="ory-bot <60093411+ory-bot@users.noreply.git... |
Shell Script | hydra/scripts/5min-tutorial.sh | #!/bin/bash
DB=${DB:-postgres}
TRACING=${TRACING:-false}
PROMETHEUS=${PROMETHEUS:-false}
DC="docker-compose -f quickstart.yml"
if [[ $DB == "mysql" ]]; then
DC+=" -f quickstart-mysql.yml"
fi
if [[ $DB == "postgres" ]]; then
DC+=" -f quickstart-postgres.yml"
fi
if [[ $TRACING == true ]]; then
DC+=" -f quic... |
Shell Script | hydra/scripts/db-diff.sh | #!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
# This script is used to generate and compare the Hydra DDL at different
# versions. This is useful when reviewing changes and troubleshooting
# migrations.
#
# Side effects:
# - Creates a directory at ./output/sql and stores the generated SQL
#
# Arguments:
#... |
Shell Script | hydra/scripts/db-placeholders.sh | #!/bin/bash
set -Eeuo pipefail
# This script generates down migrations templates and is part of the
# SQL migration pipeline.
for f in $(find . -name "*.up.sql"); do
base=$(basename $f)
dir=$(dirname $f)
migra_name=$(echo $base | sed -e "s/\..*\.up\.sql//" | sed -e "s/\.up\.sql//")
echo $migra_name
if compgen -... |
Shell Script | hydra/scripts/render-schemas.sh | #!/bin/sh
set -euxo pipefail
ory_x_version="$(go list -f '{{.Version}}' -m github.com/ory/x)"
sed "s!ory://tracing-config!https://raw.githubusercontent.com/ory/x/$ory_x_version/otelx/config.schema.json!g;" spec/config.json > .schema/config.schema.json
git commit --author="ory-bot <60093411+ory-bot@users.noreply.git... |
Shell Script | hydra/scripts/run-bench.sh | #!/bin/bash
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
numReqs=10000
numParallel=100
cat > BENCHMARKS.md << EOF
---
id: hydra
title: ORY Hydra
---
In this document you will find benchmark results for different endpoints of ORY Hydra. All benchmarks are executed
using [rakyll/hey](https://github.c... |
Shell Script | hydra/scripts/run-configuration.sh | #!/bin/bash
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
# shellcheck disable=SC2006
cat > configuration.md << EOF
---
id: configuration
title: Configuration
---
\`\`\`yaml
`cat ./docs/config.yaml`
\`\`\`
EOF |
Shell Script | hydra/scripts/run-gensdk.sh | #!/bin/bash
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
scripts/run-genswag.sh
rm -rf ./sdk/go/hydra/swagger
rm -rf ./sdk/js/swagger
rm -rf ./sdk/php/swagger
rm -rf ./sdk/java
# curl -O scripts/swagger-codegen-cli-2.2.3.jar http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.3/swagg... |
Shell Script | hydra/scripts/run-genswag.sh | #!/bin/bash
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
swagger generate spec -m -o ./docs/api.swagger.json |
Shell Script | hydra/scripts/test-env.sh | #!/bin/bash
export TEST_DATABASE_MYSQL='mysql://root:secret@(127.0.0.1:3444)/mysql?parseTime=true&multiStatements=true'
export TEST_DATABASE_POSTGRESQL='postgres://postgres:secret@127.0.0.1:3445/postgres?sslmode=disable'
export TEST_DATABASE_COCKROACHDB='cockroach://root@127.0.0.1:3446/defaultdb?sslmode=disable' |
Go | hydra/spec/api.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package spec
import _ "embed"
//go:embed api.json
var API []byte |
JSON | hydra/spec/api.json | {
"components": {
"responses": {
"emptyResponse": {
"description": "Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is\ntypically 201."
},
"errorOAuth2BadRequest": {
"content": {
"application/json": {
... |
Go | hydra/spec/config.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package spec
import (
"bytes"
_ "embed"
"io"
"github.com/gofrs/uuid"
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"github.com/ory/x/logrusx"
"github.com/ory/x/otelx"
)
//go:embed config.json
var ConfigValidationSchema []byte
var Co... |
JSON | hydra/spec/config.json | {
"$id": "https://github.com/ory/hydra/spec/config.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Ory Hydra Configuration",
"type": "object",
"definitions": {
"http_method": {
"type": "string",
"enum": [
"POST",
"GET",
"PUT",
"PATCH",
... |
Go | hydra/spec/schemas_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package spec
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/ory/jsonschema/v3"
)
func TestConfigSchema(t *testing.T) {
c := jsonschema.NewCompiler()
require.NoError(t, AddConfigSchema(c))
_, err := c.Compil... |
JSON | hydra/spec/swagger.json | {
"consumes": [
"application/json",
"application/x-www-form-urlencoded"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"swagger": "2.0",
"info": {
"description": "Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP API... |
JSON | hydra/test/conformance/config.json | {
"server": {
"discoveryUrl": "https://hydra:4444/.well-known/openid-configuration"
},
"client": {
"client_name": "oidc-conform"
},
"client2": {
"client_name": "oidc-conform-secondary"
},
"browser": [
{
"match": "https://hydra:4444*",
"tasks": [
{
"task": "Log... |
YAML | hydra/test/conformance/docker-compose.yml | version: "3.7"
services:
hydra-migrate:
build:
# When running with `run.sh` the cwd is the project's root.
context: .
dockerfile: ./test/conformance/hydra/Dockerfile
hydra:
build:
# When running with `run.sh` the cwd is the project's root.
context: .
dockerfile: ./test/... |
hydra/test/conformance/Dockerfile | FROM maven:3-jdk-11
WORKDIR /usr/src/mymaven
RUN wget https://gitlab.com/openid/conformance-suite/-/archive/release-v4.1.4/conformance-suite-release-v4.1.4.zip && \
unzip conformance-suite-release-v4.1.4.zip -d . && \
rm conformance-suite-release-v4.1.4.zip && \
find conformance-suite-release-v4.1.4 -maxdepth 1... | |
Shell Script | hydra/test/conformance/publish.sh | #!/bin/bash
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
docker build -t oryd/hydra-oidc-server:latest .
docker build -t oryd/hydra-oidc-httpd:latest -f httpd/Dockerfile .
docker push oryd/hydra-oidc-server:latest
docker push oryd/hydra-oidc-httpd:latest |
Shell Script | hydra/test/conformance/purge.sh | #!/bin/bash
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/../.."
docker-compose -f quickstart.yml -f quickstart-postgres.yml -f test/conformance/docker-compose.yml down -v |
Go | hydra/test/conformance/run_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
//go:build conformity
// +build conformity
package main
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io"
"math/rand"
"net/http"
"net/url"
"os"
"path/filepath"
"testing"
"time"
backoff "github.com/cenkalti/backoff/v3"
hydrac "githu... |
Shell Script | hydra/test/conformance/start.sh | #!/bin/bash
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/../.."
# shellcheck disable=SC2086
docker-compose -f quickstart.yml -f quickstart-postgres.yml -f test/conformance/docker-compose.yml up ${1:-} -d --force-recreate --build |
Shell Script | hydra/test/conformance/test.sh | #!/bin/bash
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
go test -tags conformity -test.timeout 60m -failfast "$@" . |
hydra/test/conformance/httpd/Dockerfile | FROM debian:stretch
RUN apt-get update \
&& apt-get install -y apache2 ssl-cert ca-certificates \
&& apt-get clean
RUN \
echo 'Listen 8443' > /etc/apache2/ports.conf \
&& a2enmod headers proxy proxy_ajp proxy_http rewrite ssl \
&& a2dissite 000-default.conf
COPY httpd/server.conf /etc/apache2/sites-enabled
COPY ... | |
hydra/test/conformance/httpd/server.conf | <VirtualHost *:8443>
ServerName localhost
ErrorLog /dev/stderr
CustomLog /dev/stdout combined
ProxyPreserveHost on
RewriteEngine on
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ory-conformity.crt
SSLCertificateKeyFile /etc/ssl/private/ory-conformity.key
RequestHeader set X-Ssl-Cipher "%{SSL_CIPHER}s"
Reques... | |
hydra/test/conformance/hydra/Dockerfile | FROM golang:1.20-buster AS builder
RUN apt-get update && \
apt-get install --no-install-recommends -y \
git gcc bash ssl-cert ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /go/src/github.com/ory/hydra
RUN mkdir -p ./internal/httpclient
COPY go.mod go.sum ./
COPY internal/httpclient/go.* ./inte... | |
YAML | hydra/test/conformance/hydra/config/hydra.yml | serve:
cookies:
same_site_mode: Lax
tls:
enabled: true
cert:
path: /etc/ssl/certs/ory-conformity.crt
key:
path: /etc/ssl/private/ory-conformity.key
log:
level: trace
format: json
urls:
self:
issuer: https://hydra:4444/
consent: http://consent:3000/consent
login: http://co... |
Shell Script | hydra/test/conformance/ssl/generate.sh | #!/bin/bash
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
subj="/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=ory.sh.local"
openssl genrsa -out ory-ca.key 2048
openssl req -x509 -new -nodes -key ory-ca.key -sha256 -days 4096 -out ory-ca.pem -subj "$subj"
NAME=ory-conformity
openssl genrsa... |
hydra/test/conformance/ssl/ory-ca.key | -----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCzxpUrcz4CSi3F
4JCsjIHVe9fZAgax8OWKu+tP6KjnA9nOoF81NEm8etaS1wD071op6MS7qEZ52Ipz
iRjca7dNz0O6rIIZ+Div/4vnQ8zM39hW/nP7x97tGiug+QOh6cN9UiitlzugBuFz
+4N2RNjUfnGUST9080AaTjR4hAp7hyYHmjLFEu/fMQucVDuvUBR7ncMRisclNcj2
6lMaOp6ohm7GWatJ+MMbZE2Gwi4TlJS8... | |
hydra/test/conformance/ssl/ory-ca.pem | -----BEGIN CERTIFICATE-----
MIID0TCCArmgAwIBAgIUWUAyEMCvpI3KIVx017/mT06RrHkwDQYJKoZIhvcNAQEL
BQAweDELMAkGA1UEBhMCR0IxDzANBgNVBAgMBkxvbmRvbjEPMA0GA1UEBwwGTG9u
ZG9uMRgwFgYDVQQKDA9HbG9iYWwgU2VjdXJpdHkxFjAUBgNVBAsMDUlUIERlcGFy
dG1lbnQxFTATBgNVBAMMDG9yeS5zaC5sb2NhbDAeFw0yMzAzMDExMjAzNTlaFw0z
NDA1MTgxMjAzNTlaMHgxCzAJBgNVBAYT... | |
hydra/test/conformance/ssl/ory-conformity.crt | -----BEGIN CERTIFICATE-----
MIID9zCCAt+gAwIBAgIJAN1rcgmZkXW/MA0GCSqGSIb3DQEBCwUAMHgxCzAJBgNV
BAYTAkdCMQ8wDQYDVQQIDAZMb25kb24xDzANBgNVBAcMBkxvbmRvbjEYMBYGA1UE
CgwPR2xvYmFsIFNlY3VyaXR5MRYwFAYDVQQLDA1JVCBEZXBhcnRtZW50MRUwEwYD
VQQDDAxvcnkuc2gubG9jYWwwHhcNMjMwMzAxMTIwMzU5WhcNMjUwNjAzMTIwMzU5
WjB4MQswCQYDVQQGEwJHQjEPMA0GA1UE... | |
hydra/test/conformance/ssl/ory-conformity.csr | -----BEGIN CERTIFICATE REQUEST-----
MIICvTCCAaUCAQAweDELMAkGA1UEBhMCR0IxDzANBgNVBAgMBkxvbmRvbjEPMA0G
A1UEBwwGTG9uZG9uMRgwFgYDVQQKDA9HbG9iYWwgU2VjdXJpdHkxFjAUBgNVBAsM
DUlUIERlcGFydG1lbnQxFTATBgNVBAMMDG9yeS5zaC5sb2NhbDCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAIklO6g311POZ1eFLtL4GBn1zcRYXOmHMrou
tS326D/jHHMyRtpXR3kJ+b+P... | |
hydra/test/conformance/ssl/ory-conformity.ext | authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = httpd
DNS.2 = hydra
DNS.3 = consent
IP.1 = 127.0.0.1 | |
hydra/test/conformance/ssl/ory-conformity.key | -----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJJTuoN9dTzmdX
hS7S+BgZ9c3EWFzphzK6LrUt9ug/4xxzMkbaV0d5Cfm/j+m02GORVrpbJnaeuAw0
7VwmtWwwm/DRTbeChwC8Py7+1RuDAfVvNoQVRciE4Esw78OspemKYA7AMbh9nfLB
JyfA4zKWJZxXtT02l0/vrfVQpZamgAH/vpyUz7HmWs4VDRipeFBIkPCxnPhPLydt
GPvqWML9qxTOgCnItKmyAHPkZqbFepVq... | |
Markdown | hydra/test/conformance/ssl/README.md | This directory contains SSL certificates required for deploying Ory Hydra, the
OpenID Connect Conformity Test Suite, and other components with SSL
certificates. These certificates are loaded into the Docker Images and are seen
as valid CAs.
To generate a new CA and new SSL certificates, run `./generate.sh` in this
dir... |
hydra/test/e2e/circle-ci.bash | #!/bin/bash
set -euxo pipefail
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function catch {
cat ./oauth2-client.e2e.log || true
cat ./login-consent-logout.e2e.log || true
cat ./hydra.e2e.log || true
}
trap catch ERR
killall hydra || true
killall node || true
# Check if any ports th... | |
YAML | hydra/test/e2e/docker-compose.cockroach.yml | version: "3"
services:
hydra-migrate:
image: oryd/hydra:e2e
environment:
- DSN=cockroach://root@cockroachd:26257/defaultdb?sslmode=disable&max_conns=20&max_idle_conns=4
command: migrate sql -e --yes
restart: on-failure
hydra:
depends_on:
- hydra-migrate
environment:
- DSN... |
YAML | hydra/test/e2e/docker-compose.jwt.yml | ###########################################################################
####### FOR DEMONSTRATION PURPOSES ONLY #######
###########################################################################
# #
# If you have no... |
YAML | hydra/test/e2e/docker-compose.mysql.yml | version: "3"
services:
hydra-migrate:
image: oryd/hydra:e2e
environment:
- DSN=mysql://root:secret@tcp(mysqld:3306)/mysql?max_conns=20&max_idle_conns=4
command: migrate sql -e --yes
restart: on-failure
hydra:
depends_on:
- hydra-migrate
environment:
- DSN=mysql://root:sec... |
YAML | hydra/test/e2e/docker-compose.postgres.yml | version: "3"
services:
hydra-migrate:
image: oryd/hydra:e2e
environment:
- DSN=postgres://hydra:secret@postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
command: migrate sql -e --yes
restart: on-failure
hydra:
depends_on:
- hydra-migrate
environment:
- DS... |
YAML | hydra/test/e2e/docker-compose.yml | version: "3"
services:
hydra:
depends_on:
- jaeger
image: oryd/hydra:e2e
ports:
- "5004:4444" # Public port
- "5001:4445" # Admin port
command: serve all --dev
environment:
- URLS_SELF_ISSUER=http://127_0_0_1:5004/
- URLS_CONSENT=http://127_0_0_1:5002/consent
-... |
SQL | hydra/test/e2e/schema.sql | CREATE TABLE schema_migration (version VARCHAR (48) NOT NULL, version_self INT NOT NULL DEFAULT 0);
CREATE UNIQUE INDEX schema_migration_version_idx ON schema_migration (version);
CREATE INDEX schema_migration_version_self_idx ON schema_migration (version_self);
CREATE TABLE hydra_client
(
id ... |
hydra/test/e2e/oauth2-client/Dockerfile | FROM node:10.8-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install --silent; exit 0
ENTRYPOINT npm start
EXPOSE 3000 | |
JSON | hydra/test/e2e/oauth2-client/package-lock.json | {
"name": "ory-hydra-mock-oauth2-client",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ory-hydra-mock-oauth2-client",
"version": "0.0.0",
"dependencies": {
"body-parser": "^1.20.1",
"dotenv": "^7.0.0",
"express": "^4.18.... |
JSON | hydra/test/e2e/oauth2-client/package.json | {
"name": "ory-hydra-mock-oauth2-client",
"version": "0.0.0",
"private": true,
"main": "./src/index.js",
"scripts": {
"consent": "node node_modules/hydra-login-consent-logout/lib/app.js",
"start": "node ./src/index.js",
"watch": "nodemon ./src/index.js"
},
"dependencies": {
"body-parser": ... |
JavaScript | hydra/test/e2e/oauth2-client/src/index.js | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
const express = require("express")
const session = require("express-session")
const uuid = require("node-uuid")
const oauth2 = require("simple-oauth2")
const fetch = require("node-fetch")
const ew = require("express-winston")
const winston = require(... |
Go | hydra/test/mock-cb/main.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
"golang.org/x/oauth2"
)
func callback(rw http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("error") != "" {
http.Error(rw, "error h... |
Go | hydra/test/mock-client/main.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package main
import (
"bytes"
"context"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/http/cookiejar"
"net/url"
"os"
"strings"
"time"
hydra "github.com/ory/hydra-client-go/v2"
"golang.org/x/oauth2"
"github.com/ory/hydra/... |
Go | hydra/test/mock-lcp/main.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package main
import (
"log"
"net/http"
"os"
"strings"
hydra "github.com/ory/hydra-client-go/v2"
"github.com/ory/x/pointerx"
"github.com/ory/x/urlx"
)
var hydraURL = urlx.ParseOrPanic(os.Getenv("HYDRA_ADMIN_URL"))
var client = hydra.NewAPIC... |
hydra/test/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/test/stub/ecdh.pub | -----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE9yoUEAgxTd9svwe9oPqjhcP+f2jcdTL2
Wq8Aw2v9ht1dBy00tFRPNrCxFCkvMcJFhSPoDUV5NL7zfh3/psiSNYziGPrWEJYf
gmYihjSeoOf0ru1erpBrTflImPrMftCy
-----END PUBLIC KEY----- | |
hydra/test/stub/pgp.key | -----BEGIN PGP PRIVATE KEY BLOCK-----
lQPGBFycM3oBCADUSXgKFJJMXeZbmaYhhK7Ky364MhyBDvh+J8rFdyIC2q4CNzsw
e9q+PnOEXuCYlkrtrlHkzaxRUHcva9zFC3zUbKxCa/ErfPFQD6iBheE2L2/Ihp4Z
0PMKIFJM90LRqqa3VqItfleHwT6BUp21mTzq0dZLDUAv36P8IX/N+cMTxxbUuql2
oGZ3AlzPpwwnyOif/vgYEbcK0CcwVO4+jVXQ0xEx6KArv7XZtTcFqF6YslCNVcd2
R6YcAj1DDrIGX2GgacXYl... | |
hydra/test/stub/pgp.pub | -----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFycM3oBCADUSXgKFJJMXeZbmaYhhK7Ky364MhyBDvh+J8rFdyIC2q4CNzsw
e9q+PnOEXuCYlkrtrlHkzaxRUHcva9zFC3zUbKxCa/ErfPFQD6iBheE2L2/Ihp4Z
0PMKIFJM90LRqqa3VqItfleHwT6BUp21mTzq0dZLDUAv36P8IX/N+cMTxxbUuql2
oGZ3AlzPpwwnyOif/vgYEbcK0CcwVO4+jVXQ0xEx6KArv7XZtTcFqF6YslCNVcd2
R6YcAj1DDrIGX2GgacXYlG... | |
hydra/test/stub/rsa.key | -----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAslWybuiNYR7uOgKuvaBwqVk8saEutKhOAaW+3hWF65gJei+Z
V8QFfYDxs9ZaRZlWAUMtncQPnw7ZQlXO9ogN5cMcN50C6qMOOZzghK7danalhF5l
UETC4Hk3Eisbi/PR3IfVyXaRmqL6X66MKj/JAKyD9NFIDVy52K8A198Jojnrw2+X
XQW72U68fZtvlyl/BTBWQ9Re5JSTpEcVmpCR8FrFc0RPMBm+G5dRs08vvhZNiTT2
JACO5V+J5ZrgP3s5hnGFcQFZgDnX... | |
hydra/test/stub/rsa.pub | -----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAslWybuiNYR7uOgKuvaBw
qVk8saEutKhOAaW+3hWF65gJei+ZV8QFfYDxs9ZaRZlWAUMtncQPnw7ZQlXO9ogN
5cMcN50C6qMOOZzghK7danalhF5lUETC4Hk3Eisbi/PR3IfVyXaRmqL6X66MKj/J
AKyD9NFIDVy52K8A198Jojnrw2+XXQW72U68fZtvlyl/BTBWQ9Re5JSTpEcVmpCR
8FrFc0RPMBm+G5dRs08vvhZNiTT2JACO5... | |
Go | hydra/x/audit.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"net/http"
"github.com/ory/x/logrusx"
)
func LogAudit(r *http.Request, message interface{}, logger *logrusx.Logger) {
if logger == nil {
logger = logrusx.NewAudit("", "")
}
logger = logger.WithRequest(r)
if err, ok := ... |
Go | hydra/x/audit_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"bytes"
"fmt"
"net/http"
"testing"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/ory/x/logrusx"
)
func TestLogAudit(t *testing.T) {
for k, tc := range []struct {
... |
Go | hydra/x/authenticator.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"net/http"
"net/url"
"github.com/ory/fosite"
)
type ClientAuthenticatorProvider interface {
ClientAuthenticator() ClientAuthenticator
}
type ClientAuthenticator interface {
AuthenticateClient(ctx context.Context... |
Go | hydra/x/basic_auth.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"encoding/base64"
"net/url"
)
func BasicAuth(username, password string) string {
return base64.StdEncoding.EncodeToString([]byte(url.QueryEscape(username) + ":" + url.QueryEscape(password)))
} |
Go | hydra/x/clean_sql.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"testing"
"github.com/gobuffalo/pop/v6"
)
func DeleteHydraRows(t *testing.T, c *pop.Connection) {
for _, tb := range []string{
"hydra_oauth2_access",
"hydra_oauth2_refresh",
"hydra_oauth2_code",
"hydra_oauth2_oidc",
... |
Go | hydra/x/config.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
//go:generate ../.bin/mockgen -package mock -destination ../internal/mock/config_cookie.go . CookieConfigProvider
package x
import (
"context"
"net/http"
)
type CookieConfigProvider interface {
CookieDomain(ctx context.Context) string
IsDevelo... |
Go | hydra/x/const.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
const (
OpenIDConnectKeyName = "hydra.openid.id-token"
OAuth2JWTKeyName = "hydra.jwt.access-token"
) |
Go | hydra/x/doc.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
// ORY Hydra
//
// Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
//
// Schemes: http, https
// Host:
// BasePath: /
// Version: latest
//
// Consumes:
// - application/json
// - application/x-www... |
Go | hydra/x/doc_swagger.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
// Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is
// typically 201.
//
// swagger:response emptyResponse
//
//lint:ignore U1000 Used to generate Swagger and OpenAPI definition... |
Go | hydra/x/errors.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"net/http"
"github.com/ory/fosite"
"github.com/ory/x/logrusx"
)
var (
ErrNotFound = &fosite.RFC6749Error{
CodeField: http.StatusNotFound,
ErrorField: http.StatusText(http.StatusNotFound),
DescriptionField:... |
Go | hydra/x/errors_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"bytes"
"net/http"
"strings"
"testing"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/ory/x/logrusx"
)
type errStackTracer struct{}
func (s *errStackTracer) StackT... |
Go | hydra/x/error_enhancer.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"net/http"
"github.com/pkg/errors"
"github.com/ory/fosite"
"github.com/ory/herodot"
)
type enhancedError struct {
*fosite.RFC6749Error
RequestID string `json:"request_id"`
}
func ErrorEnhancer(r *http.Request, err error)... |
Go | hydra/x/error_enhancer_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"encoding/json"
errors2 "errors"
"fmt"
"net/http"
"testing"
"github.com/ory/x/errorsx"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ory/fosite"
"githu... |
Go | hydra/x/fosite_storer.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"time"
"github.com/ory/fosite"
"github.com/ory/fosite/handler/oauth2"
"github.com/ory/fosite/handler/openid"
"github.com/ory/fosite/handler/pkce"
"github.com/ory/fosite/handler/rfc7523"
"github.com/ory/fosite/ha... |
Go | hydra/x/hasher.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"github.com/ory/fosite"
"github.com/ory/x/hasherx"
"go.opentelemetry.io/otel"
"github.com/ory/x/errorsx"
)
const tracingComponent = "github.com/ory/hydra/x"
var _ fosite.Hasher = (*Hasher)(nil)
type HashAlgori... |
Go | hydra/x/hasher_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"fmt"
"testing"
"github.com/ory/x/hasherx"
"github.com/stretchr/testify/require"
)
type hasherConfig struct {
cost uint32
}
func (c hasherConfig) HasherPBKDF2Config(ctx context.Context) *hasherx.PBKDF2Config {
... |
Go | hydra/x/int_to_bytes.go | // Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"encoding/binary"
"github.com/pkg/errors"
)
// IntToBytes converts an int64 to a byte slice. It is the inverse of BytesToInt.
func IntToBytes(i int64) []byte {
b := make([]byte, 8)
binary.LittleEndian.PutUint64(b, uint64(i))... |
Go | hydra/x/int_to_bytes_test.go | // Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"math"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_toBytes_fromBytes(t *testing.T) {
for _, tc := range []struct {
name string
i int64
}{
{
name: "ze... |
Go | hydra/x/jwt.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"encoding/base64"
"strings"
)
// Decode JWT specific base64url encoding with padding stripped
func DecodeSegment(seg string) ([]byte, error) {
if l := len(seg) % 4; l > 0 {
seg += strings.Repeat("=", 4-l)
}
return base64.... |
Go | hydra/x/pagination.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"net/http"
"net/url"
"github.com/ory/x/pagination/tokenpagination"
)
// swagger:model paginationHeaders
type PaginationHeaders struct {
// The link header contains pagination links.
//
// For details on pagination please h... |
Go | hydra/x/pointer.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
// ToPointer returns the pointer to the value.
func ToPointer[T any](val T) *T {
return &val
}
// FromPointer returns the dereferenced value or if the pointer is nil the zero value.
func FromPointer[T any, TT *T](val *T) (zero T) {
if v... |
Go | hydra/x/redirect_uri.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"net/url"
"github.com/ory/fosite"
)
type redirectConfiguration interface {
IsDevelopmentMode(context.Context) bool
}
func IsRedirectURISecure(rc redirectConfiguration) func(context.Context, *url.URL) bool {
retur... |
Go | hydra/x/redirect_uri_test.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"net/url"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type mockrc struct{ dm bool }
func (m *mockrc) IsDevelopmentMode(ctx context.Context) bool {
return m.dm
}
func T... |
Go | hydra/x/registry.go | // Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package x
import (
"context"
"github.com/hashicorp/go-retryablehttp"
"github.com/ory/x/httpx"
"github.com/ory/x/otelx"
"github.com/gorilla/sessions"
"github.com/ory/herodot"
"github.com/ory/x/logrusx"
)
type RegistryLogger interface {
L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.