* Fix XSS in runbook URL (#383) * "Release: Updated versions in package to 8.3.8" (#385) * Fix: Choose Lookup params per auth module v8.3.x (#401) * Fix: Choose Lookup params per auth module Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: Prefer pointer to struct in lookup Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: user email for ldap Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: Use only login for lookup in LDAP Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: use user email for ldap Co-authored-by: Karl Persson <kalle.persson@grafana.com> fix remaining test fix nit picks * update lock * fix integration tests * [v8.3.x] Merge 'release-8.3.9` branch (#404) * Fix: Choose Lookup params per auth module Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: Prefer pointer to struct in lookup Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: user email for ldap Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: Use only login for lookup in LDAP Co-authored-by: Karl Persson <kalle.persson@grafana.com> Fix: use user email for ldap Co-authored-by: Karl Persson <kalle.persson@grafana.com> fix remaining test fix nit picks (cherry picked from commit 09ca54d4665583b5648fea5726a19e0b58df4ec0) * fix integration tests (cherry picked from commit 16c3077bb39f41acacbef4b13c65c7c907c54de7) * Release: Bump version to 8.3.9 (#403) * Change bump-version.yml * "Release: Updated versions in package to 8.3.9" Co-authored-by: dsotirakis <dimitrios.sotirakis@grafana.com> * Update yarn.lock Co-authored-by: jguer <joao.guerreiro@grafana.com> Co-authored-by: Grot (@grafanabot) <43478413+grafanabot@users.noreply.github.com> * "Release: Updated versions in package to 8.3.10" (#409) * Update grabpl * update grabpl * CI: Update `grabpl` version - remove `--no-pull-enterprise` flag (#47013) * Update grabpl version * Sign drone * Remove --no-pull-enterprise flag * Sign drone * Update grabpl * update drone, cherry-pick some ci updates * update PR pipeline Co-authored-by: George Robinson <george.robinson@grafana.com> Co-authored-by: Grot (@grafanabot) <43478413+grafanabot@users.noreply.github.com> Co-authored-by: Jguer <joao.guerreiro@grafana.com> Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com> Co-authored-by: Kevin Minehart <kmineh0151@gmail.com> Co-authored-by: Dimitris Sotirakis <sotirakis.dim@gmail.com>
132 lines
2.5 KiB
Go
132 lines
2.5 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
"golang.org/x/oauth2"
|
|
)
|
|
|
|
const (
|
|
AuthModuleLDAP = "ldap"
|
|
)
|
|
|
|
type UserAuth struct {
|
|
Id int64
|
|
UserId int64
|
|
AuthModule string
|
|
AuthId string
|
|
Created time.Time
|
|
OAuthAccessToken string
|
|
OAuthRefreshToken string
|
|
OAuthTokenType string
|
|
OAuthExpiry time.Time
|
|
}
|
|
|
|
type ExternalUserInfo struct {
|
|
OAuthToken *oauth2.Token
|
|
AuthModule string
|
|
AuthId string
|
|
UserId int64
|
|
Email string
|
|
Login string
|
|
Name string
|
|
Groups []string
|
|
OrgRoles map[int64]RoleType
|
|
IsGrafanaAdmin *bool // This is a pointer to know if we should sync this or not (nil = ignore sync)
|
|
IsDisabled bool
|
|
}
|
|
|
|
type LoginInfo struct {
|
|
AuthModule string
|
|
User *User
|
|
ExternalUser ExternalUserInfo
|
|
LoginUsername string
|
|
HTTPStatus int
|
|
Error error
|
|
}
|
|
|
|
// RequestURIKey is used as key to save request URI in contexts
|
|
// (used for the Enterprise auditing feature)
|
|
type RequestURIKey struct{}
|
|
|
|
// ---------------------
|
|
// COMMANDS
|
|
|
|
type UpsertUserCommand struct {
|
|
ReqContext *ReqContext
|
|
ExternalUser *ExternalUserInfo
|
|
UserLookupParams
|
|
Result *User
|
|
SignupAllowed bool
|
|
}
|
|
|
|
type SetAuthInfoCommand struct {
|
|
AuthModule string
|
|
AuthId string
|
|
UserId int64
|
|
OAuthToken *oauth2.Token
|
|
}
|
|
|
|
type UpdateAuthInfoCommand struct {
|
|
AuthModule string
|
|
AuthId string
|
|
UserId int64
|
|
OAuthToken *oauth2.Token
|
|
}
|
|
|
|
type DeleteAuthInfoCommand struct {
|
|
UserAuth *UserAuth
|
|
}
|
|
|
|
// ----------------------
|
|
// QUERIES
|
|
|
|
type LoginUserQuery struct {
|
|
ReqContext *ReqContext
|
|
Username string
|
|
Password string
|
|
User *User
|
|
IpAddress string
|
|
AuthModule string
|
|
Cfg *setting.Cfg
|
|
}
|
|
|
|
type GetUserByAuthInfoQuery struct {
|
|
AuthModule string
|
|
AuthId string
|
|
UserLookupParams
|
|
}
|
|
|
|
type UserLookupParams struct {
|
|
// Describes lookup order as well
|
|
UserID *int64 // if set, will try to find the user by id
|
|
Email *string // if set, will try to find the user by email
|
|
Login *string // if set, will try to find the user by login
|
|
}
|
|
|
|
type GetExternalUserInfoByLoginQuery struct {
|
|
LoginOrEmail string
|
|
|
|
Result *ExternalUserInfo
|
|
}
|
|
|
|
type GetAuthInfoQuery struct {
|
|
UserId int64
|
|
AuthModule string
|
|
AuthId string
|
|
|
|
Result *UserAuth
|
|
}
|
|
|
|
type TeamOrgGroupDTO struct {
|
|
TeamName string `json:"teamName"`
|
|
OrgName string `json:"orgName"`
|
|
GroupDN string `json:"groupDN"`
|
|
}
|
|
|
|
type GetTeamsForLDAPGroupCommand struct {
|
|
Groups []string
|
|
Result []TeamOrgGroupDTO
|
|
}
|