mirror of
https://github.com/harness/drone.git
synced 2025-05-06 20:31:01 +08:00

This change introduces the concept of a principal (abstraction of call identity), and adds a new service account type principal. Also adds support for different tokens (session, PAT, SAT, OAuth2) and adds auth.Session which is being used to capture information about the caller and call method.
24 lines
456 B
Go
24 lines
456 B
Go
package request
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
PatIDParamName = "patId"
|
|
SatIDParamName = "satId"
|
|
SessionTokenIDParamName = "sessionTokenId"
|
|
)
|
|
|
|
func GetPatID(r *http.Request) (int64, error) {
|
|
return ParseAsInt64(r, PatIDParamName)
|
|
}
|
|
|
|
func GetSatID(r *http.Request) (int64, error) {
|
|
return ParseAsInt64(r, SatIDParamName)
|
|
}
|
|
|
|
func GetSessionTokenID(r *http.Request) (int64, error) {
|
|
return ParseAsInt64(r, SessionTokenIDParamName)
|
|
}
|