You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

user_app.go 1.0KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package structs
  6. import (
  7. "encoding/base64"
  8. )
  9. // BasicAuthEncode generate base64 of basic auth head
  10. func BasicAuthEncode(user, pass string) string {
  11. return base64.StdEncoding.EncodeToString([]byte(user + ":" + pass))
  12. }
  13. // AccessToken represents an API access token.
  14. // swagger:response AccessToken
  15. type AccessToken struct {
  16. ID int64 `json:"id"`
  17. Name string `json:"name"`
  18. Token string `json:"sha1"`
  19. TokenLastEight string `json:"token_last_eight"`
  20. }
  21. // AccessTokenList represents a list of API access token.
  22. // swagger:response AccessTokenList
  23. type AccessTokenList []*AccessToken
  24. // CreateAccessTokenOption options when create access token
  25. // swagger:parameters userCreateToken
  26. type CreateAccessTokenOption struct {
  27. Name string `json:"name" binding:"Required"`
  28. }