Resolved newline issues
This commit is contained in:
parent
db7711d72a
commit
02c8f85e4d
@ -59,7 +59,6 @@ type user struct {
|
|||||||
// Open returns a connector which can be used to login users through an upstream
|
// Open returns a connector which can be used to login users through an upstream
|
||||||
// OpenShift OAuth2 provider.
|
// OpenShift OAuth2 provider.
|
||||||
func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, err error) {
|
func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, err error) {
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + "/.well-known/oauth-authorization-server"
|
wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + "/.well-known/oauth-authorization-server"
|
||||||
@ -91,7 +90,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cancel()
|
cancel()
|
||||||
return nil, fmt.Errorf("Failed to query OpenShift Endpoint %v", err)
|
return nil, fmt.Errorf("failed to query OpenShift endpoint %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
@ -211,7 +210,6 @@ func (c *openshiftConnector) user(ctx context.Context, client *http.Client) (u u
|
|||||||
}
|
}
|
||||||
|
|
||||||
func validateRequiredGroups(userGroups, requiredGroups []string) bool {
|
func validateRequiredGroups(userGroups, requiredGroups []string) bool {
|
||||||
|
|
||||||
matchingGroups := groups.Filter(userGroups, requiredGroups)
|
matchingGroups := groups.Filter(userGroups, requiredGroups)
|
||||||
|
|
||||||
return len(requiredGroups) == len(matchingGroups)
|
return len(requiredGroups) == len(matchingGroups)
|
||||||
|
@ -80,7 +80,6 @@ func TestGetUser(t *testing.T) {
|
|||||||
expectEquals(t, u.Name, "jdoe")
|
expectEquals(t, u.Name, "jdoe")
|
||||||
expectEquals(t, u.FullName, "John Doe")
|
expectEquals(t, u.FullName, "John Doe")
|
||||||
expectEquals(t, len(u.Groups), 1)
|
expectEquals(t, len(u.Groups), 1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVerifyGroupFn(t *testing.T) {
|
func TestVerifyGroupFn(t *testing.T) {
|
||||||
@ -90,7 +89,6 @@ func TestVerifyGroupFn(t *testing.T) {
|
|||||||
validGroupMembership := validateRequiredGroups(groupMembership, requiredGroups)
|
validGroupMembership := validateRequiredGroups(groupMembership, requiredGroups)
|
||||||
|
|
||||||
expectEquals(t, validGroupMembership, true)
|
expectEquals(t, validGroupMembership, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVerifyGroup(t *testing.T) {
|
func TestVerifyGroup(t *testing.T) {
|
||||||
@ -122,7 +120,6 @@ func TestVerifyGroup(t *testing.T) {
|
|||||||
expectEquals(t, u.Name, "jdoe")
|
expectEquals(t, u.Name, "jdoe")
|
||||||
expectEquals(t, u.FullName, "John Doe")
|
expectEquals(t, u.FullName, "John Doe")
|
||||||
expectEquals(t, len(u.Groups), 1)
|
expectEquals(t, len(u.Groups), 1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCallbackIdentity(t *testing.T) {
|
func TestCallbackIdentity(t *testing.T) {
|
||||||
@ -169,7 +166,6 @@ func TestCallbackIdentity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newTestServer(responses map[string]interface{}) *httptest.Server {
|
func newTestServer(responses map[string]interface{}) *httptest.Server {
|
||||||
|
|
||||||
var s *httptest.Server
|
var s *httptest.Server
|
||||||
s = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
s = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user