Merge pull request #4447 from hashicorp/identity-upgrade-nil-check
Add identity store nil checks
This commit is contained in:
commit
54eebfa200
|
@ -697,7 +697,7 @@ func (c *Core) LookupToken(token string) (*TokenEntry, error) {
|
||||||
// This list includes the policies from the entity itself and from all the
|
// This list includes the policies from the entity itself and from all the
|
||||||
// groups in which the given entity ID is a member of.
|
// groups in which the given entity ID is a member of.
|
||||||
func (c *Core) fetchEntityAndDerivedPolicies(entityID string) (*identity.Entity, []string, error) {
|
func (c *Core) fetchEntityAndDerivedPolicies(entityID string) (*identity.Entity, []string, error) {
|
||||||
if entityID == "" {
|
if entityID == "" || c.identityStore == nil {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ import (
|
||||||
func (c *Core) loadIdentityStoreArtifacts(ctx context.Context) error {
|
func (c *Core) loadIdentityStoreArtifacts(ctx context.Context) error {
|
||||||
var err error
|
var err error
|
||||||
if c.identityStore == nil {
|
if c.identityStore == nil {
|
||||||
return fmt.Errorf("identity store is not setup")
|
c.logger.Warn("identity store is not setup, skipping loading")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.identityStore.loadEntities(ctx)
|
err = c.identityStore.loadEntities(ctx)
|
||||||
|
|
|
@ -364,7 +364,8 @@ func (c *Core) handleRequest(ctx context.Context, req *logical.Request) (retResp
|
||||||
resp != nil &&
|
resp != nil &&
|
||||||
resp.Auth != nil &&
|
resp.Auth != nil &&
|
||||||
resp.Auth.EntityID != "" &&
|
resp.Auth.EntityID != "" &&
|
||||||
resp.Auth.GroupAliases != nil {
|
resp.Auth.GroupAliases != nil &&
|
||||||
|
c.identityStore != nil {
|
||||||
err := c.identityStore.refreshExternalGroupMembershipsByEntityID(resp.Auth.EntityID, resp.Auth.GroupAliases)
|
err := c.identityStore.refreshExternalGroupMembershipsByEntityID(resp.Auth.EntityID, resp.Auth.GroupAliases)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.logger.Error("failed to refresh external group memberships", "error", err)
|
c.logger.Error("failed to refresh external group memberships", "error", err)
|
||||||
|
@ -498,7 +499,10 @@ func (c *Core) handleLoginRequest(ctx context.Context, req *logical.Request) (re
|
||||||
|
|
||||||
mEntry := c.router.MatchingMountEntry(req.Path)
|
mEntry := c.router.MatchingMountEntry(req.Path)
|
||||||
|
|
||||||
if auth.Alias != nil && mEntry != nil && !mEntry.Local {
|
if auth.Alias != nil &&
|
||||||
|
mEntry != nil &&
|
||||||
|
!mEntry.Local &&
|
||||||
|
c.identityStore != nil {
|
||||||
// Overwrite the mount type and mount path in the alias
|
// Overwrite the mount type and mount path in the alias
|
||||||
// information
|
// information
|
||||||
auth.Alias.MountType = req.MountType
|
auth.Alias.MountType = req.MountType
|
||||||
|
|
Loading…
Reference in a new issue