Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas committed Nov 18, 2015
1 parent d8e49a9 commit 318e38a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions context/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ func IsAuthenticatedFromContext(ctx context.Context) bool {
return (b && a.token != nil && a.token.Valid)
}

func AuthContextIsSet(ctx context.Context) bool {
return ctx.Value(authKey) != nil
}

func NewContextFromAuthValues(ctx context.Context, claims hjwt.ClaimsCarrier, token *jwt.Token, policies []policy.Policy) context.Context {
return context.WithValue(ctx, authKey, &authorization{
claims: claims,
Expand Down
12 changes: 12 additions & 0 deletions jwt/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/require"
"testing"
"time"
"github.com/RangelReale/osin"
)

func TestMerge(t *testing.T) {
Expand Down Expand Up @@ -64,6 +65,17 @@ func TestVerifyPassesHeaderAlgInjection(t *testing.T) {
assert.NotNil(t, err)
}

func TestGenerateAccessToken(t *testing.T) {
j := New(
[]byte(TestCertificates[0][1]),
[]byte(TestCertificates[1][1]),
)
at, rt, err := j.GenerateAccessToken(&osin.AccessData{}, true)
assert.Nil(t, err)
assert.NotEmpty(t, at)
assert.NotEmpty(t, rt)
}

func TestSignAndVerify(t *testing.T) {
for i, c := range []struct {
private []byte
Expand Down

0 comments on commit 318e38a

Please sign in to comment.