-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move most of omegaup-update-problem's functionality to gitserver
This change is a huge refactor so that gitserver has all the functionality that used to belong to omegaup-update-problem. Now the protocol should be complete and the frontend should be able to stop assuming that it is hosted in the same filesystem as the grader.
- Loading branch information
Showing
7 changed files
with
1,076 additions
and
716 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,30 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/base64" | ||
"fmt" | ||
base "github.com/omegaup/go-base" | ||
"golang.org/x/crypto/ed25519" | ||
"testing" | ||
) | ||
|
||
const ( | ||
expiredToken = "v2.public.eyJwcm9ibGVtIjoiYTA5NGY3MWI0ZmEzZmY4YmVhZmY0MDZiNTQ1YTU1NzgiLCJleHAiOiIyMDE5LTAxLTA0VDA1OjAzOjA0KzAwOjAwIiwiaXNzIjoib21lZ2FVcCBmcm9udGVuZCIsInN1YiI6IjBiOGJhM2FjN2M2MzVkM2U2OTg5MWU4ODAzYzc4YTJmIn0VXEbZ414QQ7qEY9MFa2gGgeJqc-T1Ff7fPM3ZQ_YQudq5I05offZxG819gmdmq3Z1_HeV7bjMRWL5JIkfkHIK" | ||
) | ||
|
||
func TestParseBearerAuth(t *testing.T) { | ||
log := base.StderrLog() | ||
keyBytes, err := base64.StdEncoding.DecodeString(*publicKeyBase64) | ||
if err != nil { | ||
t.Fatalf("failed to parse shared key: %v", err) | ||
} | ||
auth := bearerAuthorization{ | ||
log: log, | ||
publicKey: ed25519.PublicKey(keyBytes), | ||
} | ||
|
||
_, _, ok := auth.parseBearerAuth(fmt.Sprintf("Bearer %s", expiredToken)) | ||
if ok { | ||
t.Errorf("expired token was passed as valid") | ||
} | ||
} |
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.