Skip to content

Commit

Permalink
all: beta preparations
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas committed Dec 7, 2015
1 parent 2d15cd7 commit 2046790
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ func (c *HTTPClient) IsAllowed(ar *AuthorizeRequest) (bool, error) {
if len(errs) > 0 {
return false, fmt.Errorf("Got errors: %v", errs)
} else if resp.StatusCode != http.StatusOK {
return false, fmt.Errorf("Got status code %s", resp.StatusCode)
return false, fmt.Errorf("Status code %d is not 200: %s", resp.StatusCode, body)
}

if err := json.Unmarshal([]byte(body), &isAllowed); err != nil {
return false, err
}

if !isAllowed.Allowed {
return false, errors.New("Authroization denied.")
return false, errors.New("Authroization denied")
}
return isAllowed.Allowed, nil
}
Expand All @@ -79,7 +79,7 @@ func (c *HTTPClient) IsAuthenticated(token string) (bool, error) {

defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return false, fmt.Errorf("Got status code %s", resp.StatusCode)
return false, fmt.Errorf("Status code %d is not 200", resp.StatusCode)
}

var introspect struct {
Expand All @@ -91,7 +91,7 @@ func (c *HTTPClient) IsAuthenticated(token string) (bool, error) {
}

if !introspect.Active {
return false, errors.New("Authentication denied.")
return false, errors.New("Authentication denied")
}
return introspect.Active, nil
}

0 comments on commit 2046790

Please sign in to comment.