stormpath

package module
v0.0.0-...-0d47c16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2015 License: Apache-2.0 Imports: 24 Imported by: 0

README

Go SDK for the Stormpath API

Develop:

Build Status codecov.io

Master:

Build Status codecov.io

#Usage

go get github.com/jarias/stormpath-sdk-go

import "github.com/jarias/stormpath-sdk-go"
import "fmt"

//This would look for env variables first STORMPATH_API_KEY_ID and STORMPATH_API_KEY_SECRET if empty
//then it would look for os.Getenv("HOME") + "/.config/stormpath/apiKey.properties" for the credentials
credentials, _ := stormpath.NewDefaultCredentials()

//Init Whithout cache
stormpath.Init(credentials, nil)

//Get the current tenant
tenant, _ := stormpath.CurrentTenant()

//Get the tenat applications
apps, _ := tenant.GetApplications(MakeApplicationCriteria().NameEq("test app"))

//Get the first application
app := apps.Items[0]

//Authenticate a user against the app
account, _ := app.AuthenticateAccount("username", "password")

fmt.Println(account)

Features:

  • Cache with a sample Redis implementation
  • Almost 100% of the Stormpath API implemented
  • Load credentials via properties file or env variables
  • Requests are authenticated via Stormpath SAuthc1 algorithm

#Debugging

If you need to trace all requests done to stormpath you can enable debugging in the logs by setting the environment variable STORMPATH_LOG_LEVEL=DEBUG the default level is ERROR.

#Contributing

Pull request are more than welcome, all pull requests should be from and directed to the develop branch NOT master.

Please make sure you add tests ;)

#License

Copyright 2014, 2015 Julio Arias

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

View Source
const (
	IDTerminator         = "sauthc1_request"
	AuthenticationScheme = "SAuthc1"
	NL                   = "\n"
	HostHeader           = "Host"
	AuthorizationHeader  = "Authorization"
	StormpathDateHeader  = "X-Stormpath-Date"
	Algorithm            = "HMAC-SHA-256"
	SAUTHC1Id            = "sauthc1Id"
	SAUTHC1SignedHeaders = "sauthc1SignedHeaders"
	SAUTHC1Signature     = "sauthc1Signature"
	DateFormat           = "20060102"
	TimestampFormat      = "20060102T150405Z0700"
)

SAuthc1 algorithm constants

Variables

View Source
var BaseURL = "https://api.stormpath.com/v1/"

BaseURL defines the Stormpath API base URL

View Source
var DefaultPageRequest = PageRequest{25, 0}
View Source
var Logger *log.Logger

Logger library wide logger

Functions

func Authenticate

func Authenticate(req *http.Request, payload []byte, date time.Time, credentials Credentials, nonce string)

Authenticate generates the proper authentication header for the SAuthc1 algorithm use by Stormpath

func Init

func Init(credentials Credentials, cache Cache)

Init initializes the underlying client that communicates with Stormpath

func InitWithCustomHTTPClient

func InitWithCustomHTTPClient(credentials Credentials, cache Cache, httpClient *http.Client)

InitWithCustomHTTPClient initializes the underlying client that communicates with Stormpath with a custom http.Client

func NewPageRequest

func NewPageRequest(limit int, offset int) url.Values

NewPageRequest is a conviniece constructor for a PageRequest

Types

type Account

type Account struct {
	Username               string            `json:"username"`
	Email                  string            `json:"email"`
	Password               string            `json:"password"`
	FullName               string            `json:"fullName,omitempty"`
	GivenName              string            `json:"givenName"`
	MiddleName             string            `json:"middleName,omitempty"`
	Surname                string            `json:"surname"`
	Status                 string            `json:"status,omitempty"`
	Groups                 *Groups           `json:"groups,omitempty"`
	GroupMemberships       *GroupMemberships `json:"groupMemberships,omitempty"`
	Directory              *Directory        `json:"directory,omitempty"`
	Tenant                 *Tenant           `json:"tenant,omitempty"`
	EmailVerificationToken *resource         `json:"emailVerificationToken,omitempty"`
	// contains filtered or unexported fields
}

Account represents an Stormpath account object

See: http://docs.stormpath.com/rest/product-guide/#accounts

func GetAccount

func GetAccount(href string, criteria Criteria) (*Account, error)

func NewAccount

func NewAccount(username, password, email, givenName, surname string) *Account

NewAccount returns a pointer to an Account with the minimum data required

func VerifyEmailToken

func VerifyEmailToken(token string) (*Account, error)

VerifyEmailToken verifies an email verification token associated with an account

See: http://docs.stormpath.com/rest/product-guide/#account-verify-email

func (*Account) AddToGroup

func (account *Account) AddToGroup(group *Group) (*GroupMembership, error)

AddToGroup adds the given account to a given group and returns the respective GroupMembership

func (*Account) DeleteCustomData

func (r *Account) DeleteCustomData() error

DeleteCustomData deletes all the resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

func (*Account) GetCustomData

func (r *Account) GetCustomData() (CustomData, error)

GetCustomData returns the given resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

func (*Account) GetGroupMemberships

func (account *Account) GetGroupMemberships(criteria Criteria) (*GroupMemberships, error)

GetGroupMemberships returns a paged result of the group memeberships of the given account

func (*Account) RemoveFromGroup

func (account *Account) RemoveFromGroup(group *Group) error

RemoveFromGroup removes the given account from the given group by searching the account groupmemberships, and deleting the corresponding one

func (*Account) UpdateCustomData

func (r *Account) UpdateCustomData(customData CustomData) (CustomData, error)

UpdateCustomData sets or updates the given resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

type AccountCriteria

type AccountCriteria struct {
	// contains filtered or unexported fields
}

func MakeAccountCriteria

func MakeAccountCriteria() AccountCriteria

func MakeAccountsCriteria

func MakeAccountsCriteria() AccountCriteria

func (AccountCriteria) EmailEq

func (c AccountCriteria) EmailEq(email string) AccountCriteria

func (AccountCriteria) GivenNameEq

func (c AccountCriteria) GivenNameEq(givenName string) AccountCriteria

func (AccountCriteria) Limit

func (c AccountCriteria) Limit(limit int) Criteria

func (AccountCriteria) MiddleNameEq

func (c AccountCriteria) MiddleNameEq(middleName string) AccountCriteria

func (AccountCriteria) Offset

func (c AccountCriteria) Offset(offset int) Criteria

func (AccountCriteria) StatusEq

func (c AccountCriteria) StatusEq(status string) AccountCriteria

func (AccountCriteria) SurnameEq

func (c AccountCriteria) SurnameEq(surname string) AccountCriteria

func (AccountCriteria) ToQueryString

func (c AccountCriteria) ToQueryString() string

func (AccountCriteria) UsernameEq

func (c AccountCriteria) UsernameEq(username string) AccountCriteria

func (AccountCriteria) WithCustomData

func (c AccountCriteria) WithCustomData() AccountCriteria

func (AccountCriteria) WithDirectory

func (c AccountCriteria) WithDirectory() AccountCriteria

func (AccountCriteria) WithGroupMemberships

func (c AccountCriteria) WithGroupMemberships(pageRequest PageRequest) AccountCriteria

func (AccountCriteria) WithGroups

func (c AccountCriteria) WithGroups(pageRequest PageRequest) AccountCriteria

func (AccountCriteria) WithTenant

func (c AccountCriteria) WithTenant() AccountCriteria

type AccountPasswordResetToken

type AccountPasswordResetToken struct {
	Href    string
	Email   string
	Account Account
}

AccountPasswordResetToken represents an password reset token for a given account

See: http://docs.stormpath.com/rest/product-guide/#application-accounts (Reset An Account’s Password)

type AccountStoreMapping

type AccountStoreMapping struct {
	ListIndex             *int        `json:"collectionResourceIndex,omitempty"`
	IsDefaultAccountStore *bool       `json:"isDefaultAccountStore,omitempty"`
	IsDefaultGroupStore   *bool       `json:"isDefaultGroupStore,omitempty"`
	Application           Application `json:"application"`
	AccountStore          resource    `json:"accountStore"`
	CreatedAt             time.Time   `json:"createdAt,omitempty"`
	ModifiedAt            time.Time   `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

AccountStoreMapping represents an Stormpath account store mapping

See: http://docs.stormpath.com/rest/product-guide/#account-store-mappings

func NewAccountStoreMapping

func NewAccountStoreMapping(applicationHref string, accountStoreHref string) *AccountStoreMapping

NewAccountStoreMapping creates a new account store mappings

func (*AccountStoreMapping) Delete

func (r *AccountStoreMapping) Delete() error

Delete deletes the given account, it wont modify the calling account

func (AccountStoreMapping) IsCacheable

func (r AccountStoreMapping) IsCacheable() bool

func (*AccountStoreMapping) Refresh

func (r *AccountStoreMapping) Refresh() error

Refresh refreshes the resource by doing a GET to the resource href endpoint

func (*AccountStoreMapping) Save

func (mapping *AccountStoreMapping) Save() error

Save saves the given account store mapping

type AccountStoreMappingCriteria

type AccountStoreMappingCriteria struct {
	// contains filtered or unexported fields
}

func MakeAccountStoreMappingCriteria

func MakeAccountStoreMappingCriteria() AccountStoreMappingCriteria

func MakeAccountStoreMappingsCriteria

func MakeAccountStoreMappingsCriteria() AccountStoreMappingCriteria

func (AccountStoreMappingCriteria) Limit

func (c AccountStoreMappingCriteria) Limit(limit int) Criteria

func (AccountStoreMappingCriteria) Offset

func (c AccountStoreMappingCriteria) Offset(offset int) Criteria

func (AccountStoreMappingCriteria) ToQueryString

func (c AccountStoreMappingCriteria) ToQueryString() string

func (AccountStoreMappingCriteria) WithApplication

type AccountStoreMappings

type AccountStoreMappings struct {
	Items []AccountStoreMapping `json:"items"`
	// contains filtered or unexported fields
}

AccountStoreMappings represents a pages result of account store mappings

See: http://docs.stormpath.com/rest/product-guide/#collectionResource-account-store-mappings

func (AccountStoreMappings) IsCacheable

func (r AccountStoreMappings) IsCacheable() bool

type Accounts

type Accounts struct {
	Items []Account `json:"items"`
	// contains filtered or unexported fields
}

Accounts represents a paged result of Account objects

See: http://docs.stormpath.com/rest/product-guide/#accounts-collectionResource

func (Accounts) IsCacheable

func (r Accounts) IsCacheable() bool

type Application

type Application struct {
	Name                       string                `json:"name,omitempty"`
	Description                string                `json:"description,omitempty"`
	Status                     string                `json:"status,omitempty"`
	Groups                     *Groups               `json:"groups,omitempty"`
	Tenant                     *Tenant               `json:"tenant,omitempty"`
	PasswordResetTokens        *resource             `json:"passwordResetTokens,omitempty"`
	AccountStoreMappings       *AccountStoreMappings `json:"accountStoreMappings,omitempty"`
	DefaultAccountStoreMapping *AccountStoreMapping  `json:"defaultAccountStoreMapping,omitempty"`
	DefaultGroupStoreMapping   *AccountStoreMapping  `json:"defaultGroupStoreMapping,omitempty"`
	CreatedAt                  time.Time             `json:"createdAt,omitempty"`
	ModifiedAt                 time.Time             `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

Application represents a Stormpath application object

See: http://docs.stormpath.com/rest/product-guide/#applications

func GetApplication

func GetApplication(href string, criteria Criteria) (*Application, error)

func NewApplication

func NewApplication(name string) *Application

NewApplication creates a new application

func (*Application) AuthenticateAccount

func (app *Application) AuthenticateAccount(username string, password string) (*Account, error)

AuthenticateAccount authenticates an account against the application

See: http://docs.stormpath.com/rest/product-guide/#authenticate-an-account

func (*Application) CreateGroup

func (app *Application) CreateGroup(group *Group) error

CreateGroup creates a new group in the application

See: http://docs.stormpath.com/rest/product-guide/#application-groups

func (*Application) CreateIDSiteURL

func (app *Application) CreateIDSiteURL(options map[string]string) (string, error)

CreateIDSiteURL creates the IDSite URL for the application

func (*Application) GetAccountStoreMappings

func (app *Application) GetAccountStoreMappings(criteria Criteria) (*AccountStoreMappings, error)

GetAccountStoreMappings returns all the applications account store mappings

See: http://docs.stormpath.com/rest/product-guide/#application-account-store-mappings

func (*Application) GetAccounts

func (r *Application) GetAccounts(criteria Criteria) (*Accounts, error)

GetAccounts returns all the accounts of the application

See: http://docs.stormpath.com/rest/product-guide/#application-accounts

func (*Application) GetGroups

func (app *Application) GetGroups(criteria Criteria) (*Groups, error)

GetGroups returns all the application groups

See: http://docs.stormpath.com/rest/product-guide/#application-groups

func (*Application) HandleIDSiteCallback

func (app *Application) HandleIDSiteCallback(URL string) (*IDSiteCallbackResult, error)

HandleIDSiteCallback handles the URL from an ID Site callback it parses the JWT token validates it and return an IDSiteCallbackResult with the token info + the Account if the sub was given

func (*Application) Purge

func (app *Application) Purge() error

Purge deletes all the account stores before deleting the application

See: http://docs.stormpath.com/rest/product-guide/#delete-an-application

func (*Application) RegisterAccount

func (app *Application) RegisterAccount(account *Account) error

RegisterAccount registers a new account into the application

See: http://docs.stormpath.com/rest/product-guide/#application-accounts

func (*Application) RegisterSocialAccount

func (app *Application) RegisterSocialAccount(socialAccount *SocialAccount) (*Account, error)

RegisterSocialAccount registers a new account into the application using an external provider Google, Facebook

See: http://docs.stormpath.com/rest/product-guide/#accessing-accounts-with-google-authorization-codes-or-an-access-tokens

func (*Application) ResetPassword

func (app *Application) ResetPassword(token string, newPassword string) (*Account, error)

ResetPassword resets a user password based on the reset token

See: http://docs.stormpath.com/rest/product-guide/#reset-an-accounts-password

func (*Application) SendPasswordResetEmail

func (app *Application) SendPasswordResetEmail(username string) (*AccountPasswordResetToken, error)

SendPasswordResetEmail sends a password reset email to the given user

See: http://docs.stormpath.com/rest/product-guide/#reset-an-accounts-password

func (*Application) ValidatePasswordResetToken

func (app *Application) ValidatePasswordResetToken(token string) (*AccountPasswordResetToken, error)

ValidatePasswordResetToken validates a password reset token

See: http://docs.stormpath.com/rest/product-guide/#reset-an-accounts-password

type ApplicationCriteria

type ApplicationCriteria struct {
	// contains filtered or unexported fields
}

func MakeApplicationCriteria

func MakeApplicationCriteria() ApplicationCriteria

func MakeApplicationsCriteria

func MakeApplicationsCriteria() ApplicationCriteria

func (ApplicationCriteria) DescriptionEq

func (c ApplicationCriteria) DescriptionEq(description string) ApplicationCriteria

func (ApplicationCriteria) Limit

func (c ApplicationCriteria) Limit(limit int) Criteria

func (ApplicationCriteria) NameEq

func (ApplicationCriteria) Offset

func (c ApplicationCriteria) Offset(offset int) Criteria

func (ApplicationCriteria) StatusEq

func (c ApplicationCriteria) StatusEq(status string) ApplicationCriteria

func (ApplicationCriteria) ToQueryString

func (c ApplicationCriteria) ToQueryString() string

func (ApplicationCriteria) WithAccountStoreMappings

func (c ApplicationCriteria) WithAccountStoreMappings(pageRequest PageRequest) ApplicationCriteria

func (ApplicationCriteria) WithAccounts

func (c ApplicationCriteria) WithAccounts(pageRequest PageRequest) ApplicationCriteria

func (ApplicationCriteria) WithCustomData

func (c ApplicationCriteria) WithCustomData() ApplicationCriteria

func (ApplicationCriteria) WithDefaultAccountStoreMapping

func (c ApplicationCriteria) WithDefaultAccountStoreMapping() ApplicationCriteria

func (ApplicationCriteria) WithDefaultGroupStoreMapping

func (c ApplicationCriteria) WithDefaultGroupStoreMapping() ApplicationCriteria

func (ApplicationCriteria) WithGroups

func (c ApplicationCriteria) WithGroups(pageRequest PageRequest) ApplicationCriteria

func (ApplicationCriteria) WithTenant

type Applications

type Applications struct {
	Items []Application `json:"items"`
	// contains filtered or unexported fields
}

Applications represents a paged result or applications

func (Applications) IsCacheable

func (r Applications) IsCacheable() bool

type Cache

type Cache interface {
	Exists(key string) bool
	Set(key string, data interface{})
	Get(key string, result interface{}) error
	Del(key string)
}

Cache is a base interface for any cache provider

type Cacheable

type Cacheable interface {
	IsCacheable() bool
}

Cacheable determines if the implementor should be cached or not

type Client

type Client struct {
	Credentials Credentials
	HTTPClient  *http.Client
	Cache       Cache
}

Client is low level REST client for any Stormpath request, it holds the credentials, an the actual http client, and the cache. The Cache can be initialize in nil and the client would simply ignore it and don't cache any response.

type Credentials

type Credentials struct {
	ID     string
	Secret string
}

Credentials represents a set of Stormpath credentials

func NewCredentialsFromFile

func NewCredentialsFromFile(file string) (Credentials, error)

NewCredentialsFromFile creates a new credentials from a Stormpath key files

func NewDefaultCredentials

func NewDefaultCredentials() (Credentials, error)

NewDefaultCredentials would create a new credentials based on env variables first then the default file location at ~/.config/stormpath/apiKey.properties

type Criteria

type Criteria interface {
	ToQueryString() string
	Offset(offset int) Criteria
	Limit(limit int) Criteria
}

type CustomData

type CustomData map[string]interface{}

CustomData represents Stormpath's custom data resouce

type Directories

type Directories struct {
	Items []Directory `json:"items"`
	// contains filtered or unexported fields
}

Directories represnets a paged result of directories

func (Directories) IsCacheable

func (r Directories) IsCacheable() bool

type Directory

type Directory struct {
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Status      string    `json:"status,omitempty"`
	Groups      *Groups   `json:"groups,omitempty"`
	Tenant      *Tenant   `json:"tenant,omitempty"`
	CreatedAt   time.Time `json:"createdAt,omitempty"`
	ModifiedAt  time.Time `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

Directory represents a Stormpath directory object

See: http://docs.stormpath.com/rest/product-guide/#directories

func GetDirectory

func GetDirectory(href string, criteria Criteria) (*Directory, error)

func NewDirectory

func NewDirectory(name string) *Directory

NewDirectory creates a new directory with the given name

func (*Directory) CreateGroup

func (dir *Directory) CreateGroup(group *Group) error

CreateGroup creates a new group in the directory

func (*Directory) GetAccounts

func (r *Directory) GetAccounts(criteria Criteria) (*Accounts, error)

GetAccounts returns all the accounts of the application

See: http://docs.stormpath.com/rest/product-guide/#application-accounts

func (*Directory) GetGroups

func (dir *Directory) GetGroups(criteria Criteria) (*Groups, error)

GetGroups returns all the groups from a directory

func (*Directory) RegisterAccount

func (dir *Directory) RegisterAccount(account *Account) error

RegisterAccount registers a new account into the directory

See: http://docs.stormpath.com/rest/product-guide/#directory-accounts

func (*Directory) RegisterSocialAccount

func (dir *Directory) RegisterSocialAccount(socialAccount *SocialAccount) (*Account, error)

RegisterSocialAccount registers a new account into the application using an external provider Google, Facebook

See: http://docs.stormpath.com/rest/product-guide/#accessing-accounts-with-google-authorization-codes-or-an-access-tokens

type DirectoryCriteria

type DirectoryCriteria struct {
	// contains filtered or unexported fields
}

func MakeDirectoriesCriteria

func MakeDirectoriesCriteria() DirectoryCriteria

func MakeDirectoryCriteria

func MakeDirectoryCriteria() DirectoryCriteria

func (DirectoryCriteria) DescriptionEq

func (c DirectoryCriteria) DescriptionEq(description string) DirectoryCriteria

func (DirectoryCriteria) Limit

func (c DirectoryCriteria) Limit(limit int) Criteria

func (DirectoryCriteria) NameEq

func (DirectoryCriteria) Offset

func (c DirectoryCriteria) Offset(offset int) Criteria

func (DirectoryCriteria) StatusEq

func (c DirectoryCriteria) StatusEq(status string) DirectoryCriteria

func (DirectoryCriteria) ToQueryString

func (c DirectoryCriteria) ToQueryString() string

func (DirectoryCriteria) WithAccounts

func (c DirectoryCriteria) WithAccounts(pageRequest PageRequest) DirectoryCriteria

func (DirectoryCriteria) WithCustomData

func (c DirectoryCriteria) WithCustomData() DirectoryCriteria

func (DirectoryCriteria) WithGroups

func (c DirectoryCriteria) WithGroups(pageRequest PageRequest) DirectoryCriteria

func (DirectoryCriteria) WithTenant

func (c DirectoryCriteria) WithTenant() DirectoryCriteria

type Error

type Error struct {
	Status           int
	Code             int
	Message          string
	DeveloperMessage string
	MoreInfo         string
}

Error maps a Stormpath API JSON error object which implements Go error interface

func (Error) Error

func (e Error) Error() string

func (Error) String

func (e Error) String() string

type Group

type Group struct {
	Name        string     `json:"name,omitempty"`
	Description string     `json:"description,omitempty"`
	Status      string     `json:"status,omitempty"`
	Tenant      *Tenant    `json:"tenant,omitempty"`
	Directory   *Directory `json:"directory,omitempty"`
	CreatedAt   time.Time  `json:"createdAt,omitempty"`
	ModifiedAt  time.Time  `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

Group represents a Stormpath Group

See: http://docs.stormpath.com/rest/product-guide/#groups

func GetGroup

func GetGroup(href string, criteria Criteria) (*Group, error)

func NewGroup

func NewGroup(name string) *Group

NewGroup creates a new Group with the given name

func (*Group) GetAccounts

func (r *Group) GetAccounts(criteria Criteria) (*Accounts, error)

GetAccounts returns all the accounts of the application

See: http://docs.stormpath.com/rest/product-guide/#application-accounts

func (*Group) GetGroupMemberships

func (group *Group) GetGroupMemberships(criteria Criteria) (*GroupMemberships, error)

type GroupCriteria

type GroupCriteria struct {
	// contains filtered or unexported fields
}

func MakeGroupCriteria

func MakeGroupCriteria() GroupCriteria

func MakeGroupMemershipsCriteria

func MakeGroupMemershipsCriteria() GroupCriteria

func MakeGroupsCriteria

func MakeGroupsCriteria() GroupCriteria

func (GroupCriteria) DescriptionEq

func (c GroupCriteria) DescriptionEq(description string) GroupCriteria

func (GroupCriteria) Limit

func (c GroupCriteria) Limit(limit int) Criteria

func (GroupCriteria) NameEq

func (c GroupCriteria) NameEq(name string) GroupCriteria

func (GroupCriteria) Offset

func (c GroupCriteria) Offset(offset int) Criteria

func (GroupCriteria) StatusEq

func (c GroupCriteria) StatusEq(status string) GroupCriteria

func (GroupCriteria) ToQueryString

func (c GroupCriteria) ToQueryString() string

func (GroupCriteria) WithAccounts

func (c GroupCriteria) WithAccounts(pageRequest PageRequest) GroupCriteria

func (GroupCriteria) WithCustomData

func (c GroupCriteria) WithCustomData() GroupCriteria

func (GroupCriteria) WithDirectory

func (c GroupCriteria) WithDirectory() GroupCriteria

func (GroupCriteria) WithTenant

func (c GroupCriteria) WithTenant() GroupCriteria

type GroupMembership

type GroupMembership struct {
	Account    Account   `json:"account"`
	Group      Group     `json:"group"`
	CreatedAt  time.Time `json:"createdAt,omitempty"`
	ModifiedAt time.Time `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

func NewGroupMembership

func NewGroupMembership(accountHref string, groupHref string) *GroupMembership

func (*GroupMembership) Delete

func (r *GroupMembership) Delete() error

Delete deletes the given account, it wont modify the calling account

func (*GroupMembership) GetAccount

func (groupmembership *GroupMembership) GetAccount(criteria Criteria) (*Account, error)

func (*GroupMembership) GetGroup

func (groupmembership *GroupMembership) GetGroup(criteria Criteria) (*Group, error)

func (GroupMembership) IsCacheable

func (r GroupMembership) IsCacheable() bool

func (*GroupMembership) Refresh

func (r *GroupMembership) Refresh() error

Refresh refreshes the resource by doing a GET to the resource href endpoint

func (*GroupMembership) Save

func (r *GroupMembership) Save() error

Save updates the given resource, by doing a POST to the resource Href

type GroupMembershipCriteria

type GroupMembershipCriteria struct {
	// contains filtered or unexported fields
}

func MakeGroupMemershipCriteria

func MakeGroupMemershipCriteria() GroupMembershipCriteria

func (GroupMembershipCriteria) Limit

func (c GroupMembershipCriteria) Limit(limit int) Criteria

func (GroupMembershipCriteria) Offset

func (c GroupMembershipCriteria) Offset(offset int) Criteria

func (GroupMembershipCriteria) ToQueryString

func (c GroupMembershipCriteria) ToQueryString() string

func (GroupMembershipCriteria) WithAccount

func (GroupMembershipCriteria) WithGroup

type GroupMemberships

type GroupMemberships struct {
	Items []GroupMembership `json:"items"`
	// contains filtered or unexported fields
}

func (GroupMemberships) IsCacheable

func (r GroupMemberships) IsCacheable() bool

type Groups

type Groups struct {
	Items []Group `json:"items"`
	// contains filtered or unexported fields
}

Groups represent a paged result of groups

func (Groups) IsCacheable

func (r Groups) IsCacheable() bool

type IDSiteCallbackResult

type IDSiteCallbackResult struct {
	Account *Account
	State   string
	IsNew   bool
	Status  string
}

IDSiteCallbackResult holds the ID Site callback parsed JWT token information + the acccount if one was given

type PageRequest

type PageRequest struct {
	Limit  int
	Offset int
}

PageRequest contains the limit and offset values for any paginated Stormpath request

type ProviderData

type ProviderData struct {
	ProviderID  string `json:"providerId"`
	AccessToken string `json:"accessToken,omitempty"`
}

ProviderData represents the especific information needed by the social provider (Google, Github, Faceboo, etc)

type RedisCache

type RedisCache struct {
	Conn redis.Conn
}

RedisCache is the default provided implementation of the Cache interface using Redis as backend

func (RedisCache) Del

func (r RedisCache) Del(key string)

Del deletes a key from the cache

func (RedisCache) Exists

func (r RedisCache) Exists(key string) bool

Exists returns true if the key exists in the cache false otherwise

func (RedisCache) Get

func (r RedisCache) Get(key string, result interface{}) error

Get returns the data store under key it should return an error if any occur

func (RedisCache) Set

func (r RedisCache) Set(key string, data interface{})

Set stores data in the the cache for the given key

type SocialAccount

type SocialAccount struct {
	Data ProviderData `json:"providerData"`
}

SocialAccount represents the JSON payload use to create an account for a social backend directory (Google, Facebook, Github, etc)

type Tenant

type Tenant struct {
	Name         string       `json:"name"`
	Key          string       `json:"key"`
	Applications Applications `json:"applications"`
	Directories  Directories  `json:"directories"`
	CreatedAt    time.Time    `json:"createdAt,omitempty"`
	ModifiedAt   time.Time    `json:"modifiedAt,omitempty"`
	// contains filtered or unexported fields
}

Tenant represents a Stormpath tennat see http://docs.stormpath.com/rest/product-guide/#tenants

func CurrentTenant

func CurrentTenant() (*Tenant, error)

CurrentTenant returns the current tenant see http://docs.stormpath.com/rest/product-guide/#retrieve-the-current-tenant

func (*Tenant) CreateApplication

func (tenant *Tenant) CreateApplication(app *Application) error

CreateApplication creates a new application for the given tenant

See: http://docs.stormpath.com/rest/product-guide/#tenant-applications

func (*Tenant) CreateDirectory

func (tenant *Tenant) CreateDirectory(dir *Directory) error

CreateDirectory creates a new directory for the given tenant

See: http://docs.stormpath.com/rest/product-guide/#tenant-directories

func (*Tenant) DeleteCustomData

func (r *Tenant) DeleteCustomData() error

DeleteCustomData deletes all the resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

func (*Tenant) GetApplications

func (tenant *Tenant) GetApplications(criteria Criteria) (*Applications, error)

GetApplications returns all the applications for the given tenant

See: http://docs.stormpath.com/rest/product-guide/#tenant-applications

func (*Tenant) GetCustomData

func (r *Tenant) GetCustomData() (CustomData, error)

GetCustomData returns the given resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

func (*Tenant) GetDirectories

func (tenant *Tenant) GetDirectories(criteria Criteria) (*Directories, error)

GetDirectories returns all the directories for the given tenant

See: http://docs.stormpath.com/rest/product-guide/#tenant-directories

func (*Tenant) UpdateCustomData

func (r *Tenant) UpdateCustomData(customData CustomData) (CustomData, error)

UpdateCustomData sets or updates the given resource custom data

See: http://docs.stormpath.com/rest/product-guide/#custom-data

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL