-
-
Notifications
You must be signed in to change notification settings - Fork 964
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: wip login with code and cleanup
- Loading branch information
Showing
32 changed files
with
423 additions
and
79 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
5 changes: 5 additions & 0 deletions
5
...stence/sql/migratest/fixtures/registration_code/f1f66a69-ce02-4a12-9591-9e02dda30a0d.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,5 @@ | ||
{ | ||
"id": "f1f66a69-ce02-4a12-9591-9e02dda30a0d", | ||
"expires_at": "2022-08-18T08:28:18Z", | ||
"issued_at": "2022-08-18T07:28:18Z" | ||
} |
14 changes: 14 additions & 0 deletions
14
...stence/sql/migratest/fixtures/registration_flow/69c80296-36cd-4afc-921a-15369cac5bf0.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,14 @@ | ||
{ | ||
"id": "69c80296-36cd-4afc-921a-15369cac5bf0", | ||
"type": "browser", | ||
"expires_at": "2013-10-07T08:23:19Z", | ||
"issued_at": "2013-10-07T08:23:19Z", | ||
"request_url": "http://kratos:4433/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge=", | ||
"active": "password", | ||
"ui": { | ||
"action": "", | ||
"method": "", | ||
"nodes": null | ||
}, | ||
"state": "" | ||
} |
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 |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
"action": "", | ||
"method": "", | ||
"nodes": null | ||
} | ||
}, | ||
"state": "" | ||
} |
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
23 changes: 23 additions & 0 deletions
23
persistence/sql/migratest/testdata/20230707133700_testdata.sql
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,23 @@ | ||
INSERT INTO selfservice_login_flows (id, nid, request_url, issued_at, expires_at, active_method, csrf_token, created_at, | ||
updated_at, forced, type, ui, internal_context, oauth2_login_challenge_data) | ||
VALUES ('00b1517f-2467-4aaf-b0a5-82b4a27dcaf5', | ||
'0c175792-3aad-4795-ad03-972e8a88f94c', | ||
'http://kratos:4433/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login/self-service/browser/flows/login', | ||
'2013-10-07 08:23:19', '2013-10-07 08:23:19', '', | ||
'fpeVSZ9ZH7YvUkhXsOVEIssxbfauh5lcoQSYxTcN0XkMneg1L42h+HtvisjlNjBF4ElcD2jApCHoJYq2u9sVWg==', | ||
'2013-10-07 08:23:19', '2013-10-07 08:23:19', false, 'api', '{}', '{"foo":"bar"}', 'challenge data'); | ||
|
||
|
||
INSERT INTO identity_login_codes (id, code, used_at, expires_at, issued_at, selfservice_login_flow_id, | ||
identity_verifiable_address_id, created_at, updated_at, nid) | ||
VALUES ('bd292366-af32-4ba6-bdf0-11d6d1a217f3', | ||
'7eb71370d8497734ec78dfe613bf0f08967e206d2b5c2fc1243be823cfcd57a7', | ||
null, | ||
'2022-08-18 08:28:18', | ||
'2022-08-18 07:28:18', | ||
'00b1517f-2467-4aaf-b0a5-82b4a27dcaf5', | ||
'd4718a67-aec2-418d-8173-6ebc7bde3b86', | ||
'2022-08-18 07:28:18', | ||
'2022-08-18 07:28:18', | ||
'0c175792-3aad-4795-ad03-972e8a88f94c' | ||
) |
22 changes: 22 additions & 0 deletions
22
persistence/sql/migratest/testdata/20230707133701_testdata.sql
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,22 @@ | ||
INSERT INTO selfservice_registration_flows (id, nid, request_url, issued_at, expires_at, active_method, csrf_token, | ||
created_at, updated_at, type, ui, internal_context, oauth2_login_challenge) | ||
VALUES ('69c80296-36cd-4afc-921a-15369cac5bf0', '884f556e-eb3a-4b9f-bee3-11345642c6c0', | ||
'http://kratos:4433/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge/self-service/browser/flows/registration?login_challenge=', | ||
'2013-10-07 08:23:19', '2013-10-07 08:23:19', | ||
'password', 'vYYuhWXBfXKzBC+BlnbDmXfBKsUWY6SU/v04gHF9GYzPjFP51RXDPOc57R7Dpbf+XLkbPNAkmem33Crz/avdrw==', | ||
'2013-10-07 08:23:19', '2013-10-07 08:23:19', 'browser', '{}', '{"foo":"bar"}', | ||
'3caddfd5-9903-4bce-83ff-cae36f42dff7'); | ||
|
||
INSERT INTO identity_registration_codes (id, address, code, used_at, expires_at, issued_at, selfservice_registration_flow_id, | ||
created_at, updated_at, nid) | ||
VALUES ('f1f66a69-ce02-4a12-9591-9e02dda30a0d', | ||
'[email protected]', | ||
'7eb71370d8497734ec78dfe613bf0f08967e206d2b5c2fc1243be823cfcd57a7', | ||
null, | ||
'2022-08-18 08:28:18', | ||
'2022-08-18 07:28:18', | ||
'69c80296-36cd-4afc-921a-15369cac5bf0', | ||
'2022-08-18 07:28:18', | ||
'2022-08-18 07:28:18', | ||
'884f556e-eb3a-4b9f-bee3-11345642c6c0' | ||
) |
4 changes: 4 additions & 0 deletions
4
persistence/sql/migrations/sql/20230707133700000000_identity_login_code.down.sql
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,4 @@ | ||
DROP TABLE identity_login_codes; | ||
|
||
ALTER TABLE selfservice_login_flows DROP submit_count; | ||
ALTER TABLE selfservice_login_flows DROP skip_csrf_check; |
4 changes: 4 additions & 0 deletions
4
persistence/sql/migrations/sql/20230707133700000000_identity_login_code.mysql.down.sql
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,4 @@ | ||
DROP TABLE identity_login_codes; | ||
|
||
ALTER TABLE selfservice_login_flows DROP submit_count; | ||
ALTER TABLE selfservice_login_flows DROP skip_csrf_check; |
33 changes: 33 additions & 0 deletions
33
persistence/sql/migrations/sql/20230707133700000000_identity_login_code.mysql.up.sql
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,33 @@ | ||
CREATE TABLE identity_login_codes | ||
( | ||
id CHAR(36) NOT NULL PRIMARY KEY, | ||
code VARCHAR (64) NOT NULL, -- HMACed value of the actual code | ||
used_at timestamp NULL DEFAULT NULL, | ||
expires_at timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
issued_at timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
selfservice_login_flow_id CHAR(36), | ||
identity_verifiable_address_id CHAR(36), | ||
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
nid CHAR(36) NOT NULL, | ||
CONSTRAINT identity_login_codes_selfservice_login_flows_id_fk | ||
FOREIGN KEY (selfservice_login_flow_id) | ||
REFERENCES selfservice_login_flows (id) | ||
ON DELETE cascade, | ||
CONSTRAINT identity_login_codes_networks_id_fk | ||
FOREIGN KEY (nid) | ||
REFERENCES networks (id) | ||
ON UPDATE RESTRICT ON DELETE CASCADE, | ||
CONSTRAINT identity_login_codes_identity_verifiable_addresses_id_fk | ||
FOREIGN KEY (identity_verifiable_address_id) | ||
REFERENCES identity_verifiable_addresses (id) | ||
ON DELETE cascade | ||
); | ||
|
||
CREATE INDEX identity_login_codes_nid_flow_id_idx ON identity_login_codes (nid, selfservice_login_flow_id); | ||
CREATE INDEX identity_login_codes_identity_verifiable_address_id_idx ON identity_login_codes (identity_verifiable_address_id); | ||
CREATE INDEX identity_login_codes_id_nid_idx ON identity_login_codes (id, nid); | ||
|
||
|
||
ALTER TABLE selfservice_login_flows ADD submit_count int NOT NULL DEFAULT 0; | ||
ALTER TABLE selfservice_login_flows ADD skip_csrf_check boolean NOT NULL DEFAULT FALSE; |
32 changes: 32 additions & 0 deletions
32
persistence/sql/migrations/sql/20230707133700000000_identity_login_code.up.sql
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,32 @@ | ||
CREATE TABLE identity_login_codes | ||
( | ||
id UUID NOT NULL PRIMARY KEY, | ||
code VARCHAR (64) NOT NULL, -- HMACed value of the actual code | ||
used_at timestamp NULL DEFAULT NULL, | ||
expires_at timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
issued_at timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
selfservice_login_flow_id UUID NOT NULL, | ||
identity_verifiable_address_id UUID NOT NULL, | ||
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
nid UUID NOT NULL, | ||
CONSTRAINT identity_login_codes_selfservice_login_flows_id_fk | ||
FOREIGN KEY (selfservice_login_flow_id) | ||
REFERENCES selfservice_login_flows (id) | ||
ON DELETE cascade, | ||
CONSTRAINT identity_login_codes_networks_id_fk | ||
FOREIGN KEY (nid) | ||
REFERENCES networks (id) | ||
ON UPDATE RESTRICT ON DELETE CASCADE, | ||
CONSTRAINT identity_login_codes_identity_verifiable_addresses_id_fk | ||
FOREIGN KEY (identity_verifiable_address_id) | ||
REFERENCES identity_verifiable_addresses (id) | ||
ON DELETE cascade | ||
); | ||
|
||
CREATE INDEX identity_login_codes_nid_flow_id_idx ON identity_login_codes (nid, selfservice_login_flow_id); | ||
CREATE INDEX identity_login_codes_identity_verifiable_address_id_idx ON identity_login_codes (identity_verifiable_address_id); | ||
CREATE INDEX identity_login_codes_id_nid_idx ON identity_login_codes (id, nid); | ||
|
||
ALTER TABLE selfservice_login_flows ADD submit_count int NOT NULL DEFAULT 0; | ||
ALTER TABLE selfservice_login_flows ADD skip_csrf_check boolean NOT NULL DEFAULT FALSE; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.