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.
		
		
		
		
		
			
		
			
				
					
					
						
							34 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
	
	
							34 lines
						
					
					
						
							1.0 KiB
						
					
					
				| // Copyright 2014 The Gogs Authors. All rights reserved.
 | |
| // Copyright 2019 The Gitea Authors. All rights reserved.
 | |
| // Use of this source code is governed by a MIT-style
 | |
| // license that can be found in the LICENSE file.
 | |
| 
 | |
| package structs
 | |
| 
 | |
| import (
 | |
| 	"encoding/base64"
 | |
| )
 | |
| 
 | |
| // BasicAuthEncode generate base64 of basic auth head
 | |
| func BasicAuthEncode(user, pass string) string {
 | |
| 	return base64.StdEncoding.EncodeToString([]byte(user + ":" + pass))
 | |
| }
 | |
| 
 | |
| // AccessToken represents an API access token.
 | |
| // swagger:response AccessToken
 | |
| type AccessToken struct {
 | |
| 	ID             int64  `json:"id"`
 | |
| 	Name           string `json:"name"`
 | |
| 	Token          string `json:"sha1"`
 | |
| 	TokenLastEight string `json:"token_last_eight"`
 | |
| }
 | |
| 
 | |
| // AccessTokenList represents a list of API access token.
 | |
| // swagger:response AccessTokenList
 | |
| type AccessTokenList []*AccessToken
 | |
| 
 | |
| // CreateAccessTokenOption options when create access token
 | |
| // swagger:parameters userCreateToken
 | |
| type CreateAccessTokenOption struct {
 | |
| 	Name string `json:"name" binding:"Required"`
 | |
| }
 | |
| 
 |