-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PKCE authentication support for the local UI (#4843)
* runtime local auth flow * remove print stmt * review comments * lint * review comments
- Loading branch information
Showing
14 changed files
with
665 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Hard-coded first-party auth clients | ||
INSERT INTO auth_clients (id, display_name) | ||
VALUES ('12345678-0000-0000-0000-000000000004', 'Rill Localhost'); | ||
|
||
-- Table for storing authorization codes for PKCE auth flow | ||
CREATE TABLE authorization_codes ( | ||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | ||
code TEXT NOT NULL, | ||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, | ||
client_id UUID NOT NULL REFERENCES auth_clients(id) ON DELETE CASCADE, | ||
redirect_uri TEXT NOT NULL, | ||
code_challenge TEXT NOT NULL, | ||
code_challenge_method TEXT NOT NULL, | ||
expires_on TIMESTAMP NOT NULL, | ||
created_on TIMESTAMPTZ DEFAULT now() NOT NULL, | ||
updated_on TIMESTAMPTZ DEFAULT now() NOT NULL | ||
); | ||
|
||
-- create index on code column | ||
CREATE UNIQUE INDEX authorization_codes_code_idx ON authorization_codes(code); |
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,14 @@ | ||
package oauth | ||
|
||
const ( | ||
FormMediaType = "application/x-www-form-urlencoded" | ||
JSONMediaType = "application/json" | ||
) | ||
|
||
// TokenResponse contains the information returned after fetching an access token from the OAuth server. | ||
type TokenResponse struct { | ||
AccessToken string `json:"access_token"` | ||
ExpiresIn int64 `json:"expires_in,string"` | ||
TokenType string `json:"token_type"` | ||
UserID string `json:"user_id"` | ||
} |
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.