-
-
Notifications
You must be signed in to change notification settings - Fork 963
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(webauthn): passwordless registration
- Loading branch information
Showing
27 changed files
with
1,412 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package registration | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/tidwall/sjson" | ||
|
||
"github.com/ory/kratos/driver/config" | ||
"github.com/ory/x/decoderx" | ||
) | ||
|
||
func DecodeBody(p interface{}, r *http.Request, dec *decoderx.HTTP, conf *config.Config, schema []byte) error { | ||
ds, err := conf.DefaultIdentityTraitsSchemaURL() | ||
if err != nil { | ||
return err | ||
} | ||
raw, err := sjson.SetBytes(schema, | ||
"properties.traits.$ref", ds.String()+"#/properties/traits") | ||
if err != nil { | ||
return errors.WithStack(err) | ||
} | ||
|
||
compiler, err := decoderx.HTTPRawJSONSchemaCompiler(raw) | ||
if err != nil { | ||
return errors.WithStack(err) | ||
} | ||
|
||
return dec.Decode(r, p, compiler, decoderx.HTTPDecoderSetValidatePayloads(true), decoderx.HTTPDecoderJSONFollowsFormFormat()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,9 @@ | |
] | ||
}, | ||
{ | ||
"method": { | ||
"const": "webauthn" | ||
}, | ||
"required": [ | ||
"identifier", | ||
"method" | ||
|
80 changes: 80 additions & 0 deletions
80
...gistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-browser.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[ | ||
{ | ||
"attributes": { | ||
"disabled": false, | ||
"name": "csrf_token", | ||
"node_type": "input", | ||
"required": true, | ||
"type": "hidden" | ||
}, | ||
"group": "default", | ||
"messages": [], | ||
"meta": {}, | ||
"type": "input" | ||
}, | ||
{ | ||
"attributes": { | ||
"disabled": false, | ||
"name": "traits.foobar", | ||
"node_type": "input", | ||
"required": true, | ||
"type": "text" | ||
}, | ||
"group": "password", | ||
"messages": [], | ||
"meta": {}, | ||
"type": "input" | ||
}, | ||
{ | ||
"attributes": { | ||
"disabled": false, | ||
"name": "password", | ||
"node_type": "input", | ||
"required": true, | ||
"type": "password" | ||
}, | ||
"group": "password", | ||
"messages": [], | ||
"meta": { | ||
"label": { | ||
"id": 1070001, | ||
"text": "Password", | ||
"type": "info" | ||
} | ||
}, | ||
"type": "input" | ||
}, | ||
{ | ||
"attributes": { | ||
"disabled": false, | ||
"name": "traits.username", | ||
"node_type": "input", | ||
"required": true, | ||
"type": "text" | ||
}, | ||
"group": "password", | ||
"messages": [], | ||
"meta": {}, | ||
"type": "input" | ||
}, | ||
{ | ||
"attributes": { | ||
"disabled": false, | ||
"name": "method", | ||
"node_type": "input", | ||
"type": "submit", | ||
"value": "password" | ||
}, | ||
"group": "password", | ||
"messages": [], | ||
"meta": { | ||
"label": { | ||
"context": {}, | ||
"id": 1040001, | ||
"text": "Sign up", | ||
"type": "info" | ||
} | ||
}, | ||
"type": "input" | ||
} | ||
] |
Oops, something went wrong.