mirror of
https://github.com/harness/drone.git
synced 2025-05-15 08:29:52 +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.
19 lines
331 B
Go
19 lines
331 B
Go
package request
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
UserIDParamName = "userId"
|
|
ServiceAccountIDParamName = "saId"
|
|
)
|
|
|
|
func GetUserID(r *http.Request) (int64, error) {
|
|
return ParseAsInt64(r, UserIDParamName)
|
|
}
|
|
|
|
func GetServiceAccountID(r *http.Request) (int64, error) {
|
|
return ParseAsInt64(r, ServiceAccountIDParamName)
|
|
}
|