base64 cookie support

This commit is contained in:
Jehiah Czebotar
2016-06-20 07:45:43 -04:00
parent 57f82ed71e
commit cdebfd6436
9 changed files with 93 additions and 18 deletions
+2 -2
View File
@@ -3,11 +3,11 @@ package providers
import (
"encoding/json"
"fmt"
"strings"
"io/ioutil"
"log"
"net/http"
"net/url"
"strings"
)
type GitHubProvider struct {
@@ -64,7 +64,7 @@ func (p *GitHubProvider) hasOrg(accessToken string) (bool, error) {
"limit": {"100"},
}
endpoint := p.ValidateURL.Scheme + "://" + p.ValidateURL.Host + "/user/orgs?" + params.Encode()
endpoint := p.ValidateURL.Scheme + "://" + p.ValidateURL.Host + "/user/orgs?" + params.Encode()
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("Accept", "application/vnd.github.v3+json")
resp, err := http.DefaultClient.Do(req)
+2 -2
View File
@@ -13,9 +13,9 @@ const secret = "0123456789abcdefghijklmnopqrstuv"
const altSecret = "0000000000abcdefghijklmnopqrstuv"
func TestSessionStateSerialization(t *testing.T) {
c, err := cookie.NewCipher(secret)
c, err := cookie.NewCipher([]byte(secret))
assert.Equal(t, nil, err)
c2, err := cookie.NewCipher(altSecret)
c2, err := cookie.NewCipher([]byte(altSecret))
assert.Equal(t, nil, err)
s := &SessionState{
Email: "user@domain.com",