Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound abstracts the not found error. ErrNotFound = errors.New("Entity not found") // ErrInvalidID occurs when an ID is not in a valid form. ErrInvalidID = errors.New("ID is not in its proper form") // ErrAuthenticationFailure occurs when a user attempts to authenticate but // anything goes wrong. ErrAuthenticationFailure = errors.New("Authentication failed") // ErrForbidden occurs when a user tries to do something that is forbidden to them according to our access control policies. ErrForbidden = errors.New("Attempted action is not allowed") )
Functions ¶
func EnsureIndex ¶
EnsureIndex fix the indexes in the account collections
func RandStringBytes ¶
RandStringBytes Generates Random String by length
Types ¶
type Token ¶
type Token struct {
Token string `json:"token"`
}
Token is the payload we deliver to users when they authenticate.
func Authenticate ¶
Authenticate finds a user by their email and verifies their password. On success it returns a Token that can be used to authenticate in the future.
The key, keyID, and alg are required for generating the token.
type TokenGenerator ¶
TokenGenerator is the behavior we need in our Authenticate to generate tokens for authenticated users.
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id" json:"id"` IDStr string `bson:"idStr" json:"idStr"` UserID string `bson:"userId" json:"userId"` CreatedAt time.Time `json:"createdAt" bson:"createdAt"` UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` Deleted bool `json:"-" bson:"deleted"` Roles []string `bson:"roles" json:"-"` Status string `json:"status" bson:"status"` ScreenName string `bson:"screenName" json:"screenName"` FirstName string `bson:"firstName" json:"firstName"` LastName string `bson:"lastName" json:"lastName"` Email string `bson:"email" json:"email"` Mobile string `bson:"mobile" json:"mobile"` Profession string `bson:"profession" json:"profession"` Pin string `bson:"pin" json:"-"` ProfileImageURL *string `bson:"profileImageURL" json:"profileImageURL"` TwitterAccessToken *string `bson:"twitterAccessToken" json:"twitterAccessToken"` TwitterAccessTokenSecret *string `bson:"twitterAccessTokenSecret" json:"-"` OrgName string `bson:"orgname" json:"orgname"` OrgURL string `bson:"orgurl" json:"orgurl"` OrgFirstName string `bson:"orgfirstName" json:"orgfirstName"` OrgLastName string `bson:"orglastName" json:"orglastName"` OrgEmail string `bson:"orgemail" json:"orgemail"` OrgMobile string `bson:"orgmobile" json:"orgmobile"` }
User : User Schema model
func ByScreenNanme ¶
ByScreenNanme : Returns User by Twitter Screen Name
Click to show internal directories.
Click to hide internal directories.