Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ require (
github.com/oklog/ulid v1.3.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/opencontainers/runc v1.3.0 // indirect
github.com/opencontainers/runc v1.3.3 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
github.com/opencontainers/runc v1.3.0 h1:cvP7xbEvD0QQAs0nZKLzkVog2OPZhI/V2w3WmTmUSXI=
github.com/opencontainers/runc v1.3.0/go.mod h1:9wbWt42gV+KRxKRVVugNP6D5+PQciRbenB4fLVsqGPs=
github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lkFQr4=
github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI=
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
Expand Down
4 changes: 2 additions & 2 deletions internal/client-go/api_frontend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/httpclient/api_frontend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oryx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ require (
github.com/oklog/ulid v1.3.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/opencontainers/runc v1.3.0 // indirect
github.com/opencontainers/runc v1.3.3 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions oryx/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
github.com/opencontainers/runc v1.3.0 h1:cvP7xbEvD0QQAs0nZKLzkVog2OPZhI/V2w3WmTmUSXI=
github.com/opencontainers/runc v1.3.0/go.mod h1:9wbWt42gV+KRxKRVVugNP6D5+PQciRbenB4fLVsqGPs=
github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lkFQr4=
github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI=
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
Expand Down
30 changes: 24 additions & 6 deletions oryx/httpx/client_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ package httpx
import (
"net"
"net/http"
"strconv"
"strings"
)

type GeoLocation struct {
City string
Region string
Country string
City string
Region string
Country string
Latitude *float64
Longitude *float64
}

func GetClientIPAddressesWithoutInternalIPs(ipAddresses []string) (string, error) {
Expand Down Expand Up @@ -45,10 +48,25 @@ func ClientIP(r *http.Request) string {
}
}

func parseFloatHeaderValue(headerValue string) *float64 {
if headerValue == "" {
return nil
}

val, err := strconv.ParseFloat(headerValue, 64)
if err != nil {
return nil
}

return &val
}

func ClientGeoLocation(r *http.Request) *GeoLocation {
return &GeoLocation{
City: r.Header.Get("Cf-Ipcity"),
Region: r.Header.Get("Cf-Region-Code"),
Country: r.Header.Get("Cf-Ipcountry"),
City: r.Header.Get("Cf-Ipcity"),
Region: r.Header.Get("Cf-Region-Code"),
Country: r.Header.Get("Cf-Ipcountry"),
Longitude: parseFloatHeaderValue(r.Header.Get("Cf-Iplongitude")),
Latitude: parseFloatHeaderValue(r.Header.Get("Cf-Iplatitude")),
}
}
30 changes: 19 additions & 11 deletions oryx/otelx/semconv/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ func (a AttributeKey) String() string {
}

const (
AttributeKeyIdentityID AttributeKey = "IdentityID"
AttributeKeyNID AttributeKey = "ProjectID"
AttributeKeyClientIP AttributeKey = "ClientIP"
AttributeKeyGeoLocationCity AttributeKey = "GeoLocationCity"
AttributeKeyGeoLocationRegion AttributeKey = "GeoLocationRegion"
AttributeKeyGeoLocationCountry AttributeKey = "GeoLocationCountry"
AttributeKeyWorkspace AttributeKey = "WorkspaceID"
AttributeKeySubscriptionID AttributeKey = "SubscriptionID"
AttributeKeyProjectEnvironment AttributeKey = "ProjectEnvironment"
AttributeKeyWorkspaceAPIKeyID AttributeKey = "WorkspaceAPIKeyID"
AttributeKeyProjectAPIKeyID AttributeKey = "ProjectAPIKeyID"
AttributeKeyIdentityID AttributeKey = "IdentityID"
AttributeKeyNID AttributeKey = "ProjectID"
AttributeKeyClientIP AttributeKey = "ClientIP"
AttributeKeyGeoLocationCity AttributeKey = "GeoLocationCity"
AttributeKeyGeoLocationRegion AttributeKey = "GeoLocationRegion"
AttributeKeyGeoLocationCountry AttributeKey = "GeoLocationCountry"
AttributeKeyGeoLocationLatitude AttributeKey = "GeoLocationLatitude"
AttributeKeyGeoLocationLongitude AttributeKey = "GeoLocationLongitude"
AttributeKeyWorkspace AttributeKey = "WorkspaceID"
AttributeKeySubscriptionID AttributeKey = "SubscriptionID"
AttributeKeyProjectEnvironment AttributeKey = "ProjectEnvironment"
AttributeKeyWorkspaceAPIKeyID AttributeKey = "WorkspaceAPIKeyID"
AttributeKeyProjectAPIKeyID AttributeKey = "ProjectAPIKeyID"
)

func AttrIdentityID[V string | uuid.UUID](val V) otelattr.KeyValue {
Expand Down Expand Up @@ -73,6 +75,12 @@ func AttrGeoLocation(val httpx.GeoLocation) []otelattr.KeyValue {
if val.Region != "" {
geoLocationAttributes = append(geoLocationAttributes, otelattr.String(AttributeKeyGeoLocationRegion.String(), val.Region))
}
if val.Latitude != nil {
geoLocationAttributes = append(geoLocationAttributes, otelattr.Float64(AttributeKeyGeoLocationLatitude.String(), *val.Latitude))
}
if val.Longitude != nil {
geoLocationAttributes = append(geoLocationAttributes, otelattr.Float64(AttributeKeyGeoLocationLongitude.String(), *val.Longitude))
}

return geoLocationAttributes
}
Expand Down
4 changes: 2 additions & 2 deletions selfservice/flow/login/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ type createNativeLoginFlow struct {
// in: query
Via string `json:"via"`

// An optional identity schema to use for the registration flow.
// An optional identity schema to use for the login flow.
//
// required: false
// in: query
Expand Down Expand Up @@ -473,7 +473,7 @@ type createBrowserLoginFlow struct {
// in: query
Via string `json:"via"`

// An optional identity schema to use for the registration flow.
// An optional identity schema to use for the login flow.
//
// required: false
// in: query
Expand Down
4 changes: 2 additions & 2 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -6164,7 +6164,7 @@
}
},
{
"description": "An optional identity schema to use for the registration flow.",
"description": "An optional identity schema to use for the login flow.",
"in": "query",
"name": "identity_schema",
"schema": {
Expand Down Expand Up @@ -6272,7 +6272,7 @@
}
},
{
"description": "An optional identity schema to use for the registration flow.",
"description": "An optional identity schema to use for the login flow.",
"in": "query",
"name": "identity_schema",
"schema": {
Expand Down
4 changes: 2 additions & 2 deletions spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@
},
{
"type": "string",
"description": "An optional identity schema to use for the registration flow.",
"description": "An optional identity schema to use for the login flow.",
"name": "identity_schema",
"in": "query"
}
Expand Down Expand Up @@ -1893,7 +1893,7 @@
},
{
"type": "string",
"description": "An optional identity schema to use for the registration flow.",
"description": "An optional identity schema to use for the login flow.",
"name": "identity_schema",
"in": "query"
}
Expand Down
1 change: 1 addition & 0 deletions x/err.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"

"github.com/gofrs/uuid"

"github.com/ory/herodot"
)

Expand Down