Exemplo n.º 1
0
func ActionAuthentication(token string) models.Action {
	var action models.Action = models.RetrieveActionByToken(token)
	if action.UUID != "" && !action.WithinExpirationWindow() {
		action.Delete()
		return models.Action{}
	}
	return action
}
Exemplo n.º 2
0
func CreateAction(user models.User, client models.Client, ip, userAgent, scopes string) models.Action {
	var action models.Action = models.Action{
		User:      user,
		Client:    client,
		Ip:        ip,
		UserAgent: userAgent,
		Scopes:    scopes,
	}
	if err := action.Save(); err != nil {
		return models.Action{}
	}
	return action
}