Beispiel #1
0
func (this *CreateRequest) mapToHackathonEntity() entities.Hackathon {
	var newHackathon entities.Hackathon
	newHackathon.Description = this.Description
	newHackathon.HackathonId = utils.NewUUID().String()
	newHackathon.ImageId = this.ImageId
	newHackathon.Title = this.Title
	newHackathon.StartDate = this.StartDate
	newHackathon.EndDate = this.EndDate
	return newHackathon
}
Beispiel #2
0
func (this *LoginHandler) createSignedToken(account *entities.Account) (signedToken string, err error) {
	token := jwt.New(jwt.GetSigningMethod("RS256"))
	token.Claims["exp"] = time.Now().Unix() + (TOKEN_TIMEOUT_MINUTES * 60)
	token.Claims["iat"] = time.Now().Unix()
	token.Claims["nbf"] = time.Now().Unix()
	token.Claims["iss"] = TOKEN_ISSUER
	token.Claims["aud"] = TOKEN_AUDIENCE
	token.Claims["prn"] = TOKEN_PRINCIPAL
	token.Claims["jti"] = utils.NewUUID().String()
	token.Claims["sub"] = account.UserId
	token.Claims["roles"] = account.Roles
	return token.SignedString(*this.PrivateKey)
}