Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename identity traits schema to identity schema #557

Merged
merged 4 commits into from
Jul 7, 2020
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
16 changes: 8 additions & 8 deletions .schema/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@
"type": "object",
"required": [
"id",
"traits_schema_id",
"schema_id",
"traits"
],
"properties": {
Expand All @@ -1174,17 +1174,17 @@
"$ref": "#/definitions/RecoveryAddress"
}
},
"traits": {
"$ref": "#/definitions/Traits"
},
"traits_schema_id": {
"description": "TraitsSchemaID is the ID of the JSON Schema to be used for validating the identity's traits.",
"schema_id": {
"description": "SchemaID is the ID of the JSON Schema to be used for validating the identity's traits.",
"type": "string"
},
"traits_schema_url": {
"description": "TraitsSchemaURL is the URL of the endpoint where the identity's traits schema can be fetched from.\n\nformat: url",
"schema_url": {
"description": "SchemaURL is the URL of the endpoint where the identity's traits schema can be fetched from.\n\nformat: url",
"type": "string"
},
"traits": {
"$ref": "#/definitions/Traits"
},
"verifiable_addresses": {
"description": "VerifiableAddresses contains all the addresses that can be verified by the user.",
"type": "array",
Expand Down
125 changes: 58 additions & 67 deletions .schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,79 +702,70 @@
"identity": {
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"default_schema_url": {
"title": "JSON Schema URL for default identity traits",
"description": "Path to the JSON Schema which describes a default identity's traits.",
"type": "string",
"format": "uri",
"examples": [
"file://path/to/identity.traits.schema.json",
"httpss://foo.bar.com/path/to/identity.traits.schema.json"
]
},
"schemas": {
"type": "array",
"title": "Additional JSON Schemas for Identity Traits",
"examples": [
[
{
"id": "customer",
"url": "https://foo.bar.com/path/to/customer.traits.schema.json"
},
{
"id": "employee",
"url": "https://foo.bar.com/path/to/employee.traits.schema.json"
},
{
"id": "employee-v2",
"url": "https://foo.bar.com/path/to/employee.v2.traits.schema.json"
}
"default_schema_url": {
"title": "JSON Schema URL for default identity traits",
"description": "Path to the JSON Schema which describes a default identity's traits.",
"type": "string",
"format": "uri",
"examples": [
"file://path/to/identity.traits.schema.json",
"httpss://foo.bar.com/path/to/identity.traits.schema.json"
]
},
"schemas": {
"type": "array",
"title": "Additional JSON Schemas for Identity Traits",
"examples": [
[
{
"id": "customer",
"url": "https://foo.bar.com/path/to/customer.traits.schema.json"
},
{
"id": "employee",
"url": "https://foo.bar.com/path/to/employee.traits.schema.json"
},
{
"id": "employee-v2",
"url": "https://foo.bar.com/path/to/employee.v2.traits.schema.json"
}
]
],
"items": {
"type": "object",
"properties": {
"id": {
"title": "The schema's ID.",
"type": "string",
"examples": [
"employee"
]
},
"url": {
"type": "string",
"title": "Path to the JSON Schema",
"format": "uri",
"examples": [
"file://path/to/identity.traits.schema.json",
"https://foo.bar.com/path/to/identity.traits.schema.json"
]
],
"items": {
"type": "object",
"properties": {
"id": {
"title": "The schema's ID.",
"type": "string",
"examples": [
"employee"
]
},
"url": {
"type": "string",
"title": "Path to the JSON Schema",
"format": "uri",
"examples": [
"file://path/to/identity.traits.schema.json",
"https://foo.bar.com/path/to/identity.traits.schema.json"
]
}
},
"not": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^default$"
}
},
"additionalProperties": true
}
}
},
"not": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^default$"
}
},
"additionalProperties": true
}
},
"required": [
"default_schema_url"
],
"additionalProperties": false
}
}
},
"required": [
"traits"
"default_schema_url"
],
"additionalProperties": false
},
Expand Down
2 changes: 1 addition & 1 deletion continuity/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type persisterTestPayload struct {
func TestManager(t *testing.T) {
_, reg := internal.NewFastRegistryWithMocks(t)

viper.Set(configuration.ViperKeyDefaultIdentityTraitsSchemaURL, "file://./stub/identity.schema.json")
viper.Set(configuration.ViperKeyDefaultIdentitySchemaURL, "file://../test/stub/identity/empty.schema.json")
viper.Set(configuration.ViperKeyPublicBaseURL, "https://www.ory.sh")
i := identity.NewIdentity("")
require.NoError(t, reg.PrivilegedIdentityPool().CreateIdentity(context.Background(), i))
Expand Down
6 changes: 0 additions & 6 deletions continuity/stub/identity.schema.json

This file was deleted.

3 changes: 1 addition & 2 deletions contrib/quickstart/kratos/email-password/.kratos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ hashers:
key_length: 16

identity:
traits:
default_schema_url: file:///etc/config/kratos/identity.traits.schema.json
default_schema_url: file:///etc/config/kratos/identity.traits.schema.json

courier:
smtp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,33 @@
"title": "Person",
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"minLength": 3,
"ory.sh/kratos": {
"credentials": {
"password": {
"identifier": true
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"minLength": 3,
"ory.sh/kratos": {
"credentials": {
"password": {
"identifier": true
}
},
"verification": {
"via": "email"
},
"recovery": {
"via": "email"
}
}
},
"verification": {
"via": "email"
},
"recovery": {
"via": "email"
}
}
},
"required": [
"email"
],
"additionalProperties": false
}
},
"required": [
"email"
],
"additionalProperties": false
}
}
4 changes: 2 additions & 2 deletions docs/docs/concepts/credentials/openid-connect-oidc-oauth2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider (for example [ORY Hydra](https://www.ory.sh/hydra)). "Social Sign In"
or "Sign in with ..." are common aliases for this flow.

This strategy expects that you've set up your
[Identity Traits Default JSON Schema](../identity-user-model).
[Default Identity JSON Schema](../identity-user-model).

## Configuration

Expand Down Expand Up @@ -219,7 +219,7 @@ credentials:
- provider: example
identifier: some-identity-id-4hA8gk

traits_schema_url: http://foo.bar.com/person.schema.json # This comes from the default identity schema url.
schema_url: http://foo.bar.com/person.schema.json # This comes from the default identity schema url.

traits:
email: foo@ory.sh # This is extracted from `username` using
Expand Down
Loading