-
Notifications
You must be signed in to change notification settings - Fork 2
/
const.go
61 lines (57 loc) · 2.72 KB
/
const.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package pezauth
import (
"errors"
goauth2 "golang.org/x/oauth2"
)
var (
ErrCouldNotGetUserGUID = errors.New("query failed. unable to find matching user guid.")
//Vars for my oauth calls
Scopes = []string{"https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/userinfo.email"}
AuthFailureResponse = []byte(`{"error": "not logged in as a valid user, or the access token is expired"}`)
allowedDomains = []string{
"pivotal.io",
}
OauthConfig *goauth2.Config
userObjectCache = make(map[string]map[string]interface{})
//Authentication Handler vars
ErrInvalidCallerEmail = errors.New("Invalid user token for your requested action")
//ErrUnparsableHash - an error for a hash that is not formed properly
ErrUnparsableHash = errors.New("Could not parse the hash or hash was nil")
//ErrEmptyKeyResponse - an error for a invalid or empty key
ErrEmptyKeyResponse = errors.New("The key could not be found or was not valid")
//ErrNoMatchInStore - error when there is no matching org in the datastore
ErrNoMatchInStore = errors.New("Could not find a matching user org or connection failure")
//ErrCanNotCreateOrg - error when we can not create an org
ErrCanNotCreateOrg = errors.New("Could not create a new org")
//ErrCanNotAddOrgRec - error when we can not add a new org record to the datastore
ErrCanNotAddOrgRec = errors.New("Could not add a new org record")
//ErrCantCallAcrossUsers - error when a user is trying to update a user record other than their own
ErrCantCallAcrossUsers = errors.New("user calling another users endpoint")
//UserMatch exported vars
ErrNotValidActionForUser = errors.New("not a valid user to perform this action")
)
//Constants to construct my oauth calls
const (
ClientID = "1083030294947-6g3bhhrgl3s7ul736jet625ajvp94f5p.apps.googleusercontent.com"
ClientSecret = "kfgM5mT3BqPQ84VeXsYokAK_"
sessionName = "pivotalpezauthservicesession"
sessionSecret = "shhh.donttellanyone"
//FailureStatus - failure response status from our unauthenticated rest endpoints
FailureStatus = 403
//SuccessStatus - success response status from our authenticated rest endpoints
SuccessStatus = 200
//HMFieldActive - name of metadata hash field containing active status
HMFieldActive = "active"
//HMFieldDetails - name of metadata hash field containing user and key details
HMFieldDetails = "details"
//EmailFieldName - fieldname for email
EmailFieldName = "email"
//GUIDLength - length of valid key
GUIDLength = 36
//HeaderKeyName - header keyname for api-key value
HeaderKeyName = "X-API-KEY"
//ErrInvalidKeyFormatMsg - error msg for invalid key
ErrInvalidKeyFormatMsg = "Invalid key format"
//DefaultSpaceName - default space name created for each org
DefaultSpaceName = "development"
)