Documentation ¶
Index ¶
- Variables
- func AddCookie2Param(param map[string]interface{}, key string, val string, secure bool) map[string]interface{}
- func GenerateCSRF(user tinylib.UserInterface, url string, seconds int) (string, error)
- func GenerateParam(request events.APIGatewayProxyRequest) (map[string]interface{}, tinylib.UserInterface)
- func GenerateSession(user tinylib.UserInterface) (string, error)
- func GetCookieByRequest(request events.APIGatewayProxyRequest, cookie_name string) (string, error)
- func GetUserByRequest(request events.APIGatewayProxyRequest) (tinylib.UserInterface, error)
- func GetUserBySession(tokenStr string) (tinylib.UserInterface, error)
- func InitCmsConfig() error
- func LoginByTwitter(url_prefix string, request events.APIGatewayProxyRequest, ...) (events.APIGatewayProxyResponse, error)
- func LoginByTwitterCallback(request events.APIGatewayProxyRequest, param map[string]interface{}, ...) (events.APIGatewayProxyResponse, error)
- func ParseFormUrlencoded(request events.APIGatewayProxyRequest) (map[string]string, error)
- func Redirect(url string, param map[string]interface{}) events.APIGatewayProxyResponse
- func ShowAccountPage(url_prefix string, request events.APIGatewayProxyRequest, ...) (events.APIGatewayProxyResponse, error)
- func ShowConfig(request events.APIGatewayProxyRequest, param map[string]interface{}, ...) (events.APIGatewayProxyResponse, error)
- func ShowLocalUserCreatePage(url_prefix string, request events.APIGatewayProxyRequest, ...) (events.APIGatewayProxyResponse, error)
- func ShowTemplate(request events.APIGatewayProxyRequest, templateFile string, ...) (events.APIGatewayProxyResponse, error)
- func ShowTemplateWithStatusCode(request events.APIGatewayProxyRequest, templateFile string, ...) (events.APIGatewayProxyResponse, error)
- func ShowTermOfUsePage(url_prefix string, request events.APIGatewayProxyRequest, ...) (events.APIGatewayProxyResponse, error)
- func ValidateCSRF(csrf string, user tinylib.UserInterface, url string) (bool, error)
- type CmsConfigInterface
- type Oauth2Config
- type Oauth2Token
- type TermOfUseInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoFormUrlencoded = errors.New("Request's content-type is not application/x-www-form-urlencoded ") NoFormPost = errors.New("Request is not POST") ErrorCSRFExpired = errors.New("CSRF Expired.") ErrorCSRFInvalidUser = errors.New("CSRF Invalid User.") ErrorCSRFInvalidURL = errors.New("CSRF Invalid URL.") )
View Source
var ( ErrorInvalidToken = errors.New("Invalid Token.") ErrorSessionExpired = errors.New("Session Expired.") )
View Source
var (
ErrorConfigNotExists = errors.New("Config does not existed.")
)
Functions ¶
func AddCookie2Param ¶
func GenerateCSRF ¶
func GenerateParam ¶
func GenerateParam(request events.APIGatewayProxyRequest) (map[string]interface{}, tinylib.UserInterface)
func GenerateSession ¶
func GenerateSession(user tinylib.UserInterface) (string, error)
func GetCookieByRequest ¶
func GetCookieByRequest(request events.APIGatewayProxyRequest, cookie_name string) (string, error)
func GetUserByRequest ¶
func GetUserByRequest(request events.APIGatewayProxyRequest) (tinylib.UserInterface, error)
func GetUserBySession ¶
func GetUserBySession(tokenStr string) (tinylib.UserInterface, error)
func InitCmsConfig ¶
func InitCmsConfig() error
func LoginByTwitter ¶
func LoginByTwitter(url_prefix string, request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func LoginByTwitterCallback ¶
func LoginByTwitterCallback(request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func ParseFormUrlencoded ¶
func ParseFormUrlencoded(request events.APIGatewayProxyRequest) (map[string]string, error)
func Redirect ¶
func Redirect(url string, param map[string]interface{}) events.APIGatewayProxyResponse
Redirect page by status code 302
func ShowAccountPage ¶
func ShowAccountPage(url_prefix string, request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func ShowConfig ¶
func ShowConfig(request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func ShowLocalUserCreatePage ¶
func ShowLocalUserCreatePage(url_prefix string, request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func ShowTemplate ¶
func ShowTemplate(request events.APIGatewayProxyRequest, templateFile string, param map[string]interface{}) (events.APIGatewayProxyResponse, error)
Show HTML page generated by pongo2 template with status code 200
func ShowTemplateWithStatusCode ¶
func ShowTemplateWithStatusCode(request events.APIGatewayProxyRequest, templateFile string, param map[string]interface{}, statuscode int) (events.APIGatewayProxyResponse, error)
Show HTML page generated by pongo2 template with any status code
func ShowTermOfUsePage ¶
func ShowTermOfUsePage(url_prefix string, request events.APIGatewayProxyRequest, param map[string]interface{}, user tinylib.UserInterface) (events.APIGatewayProxyResponse, error)
func ValidateCSRF ¶
Types ¶
type CmsConfigInterface ¶
type CmsConfigInterface interface { Save() error GetStatus() string GetStatusCode() int GetURL_PREFIX() string GetTinyConfig() tinylib.ConfigInterface GetTermOfUse() TermOfUseInterface GetGoogleOauthClient() string GetGoogleOauthSecret() string GetTwitterConsumerKey() string GetTwitterConsumerSecret() string UpdateStatus(string) UpdateStatusCode(int) // contains filtered or unexported methods }
func GetCmsConfig ¶
func GetCmsConfig() (CmsConfigInterface, error)
type Oauth2Config ¶
func MakeOauth2Conf4google ¶
func MakeOauth2Conf4google(clientid string, clientsecret string, callback_url string) Oauth2Config
func (*Oauth2Config) Login4google ¶
func (self *Oauth2Config) Login4google(request events.APIGatewayProxyRequest, jwt_secret string) (events.APIGatewayProxyResponse, error)
func (*Oauth2Config) LoginCallback4google ¶
func (self *Oauth2Config) LoginCallback4google(request events.APIGatewayProxyRequest, jwt_secret string) (*v2.Tokeninfo, error)
type Oauth2Token ¶
type Oauth2Token struct { Token string ExpiredDate time.Time jwt.StandardClaims }
type TermOfUseInterface ¶
type TermOfUseInterface interface { Save() error Publish() error GetHTML() string SetHTML(string) GetPublishDate() string }
func GetDraftTermOfUse ¶
func GetDraftTermOfUse() (TermOfUseInterface, error)
func GetLatestTermOfUse ¶
func GetLatestTermOfUse() (TermOfUseInterface, error)
Click to show internal directories.
Click to hide internal directories.