Replug SAML configurations
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -133,11 +133,8 @@ var IAMAdminPolicy = policy.NewPolicy(
|
||||
ActionIAMInvitationGet,
|
||||
ActionIAMInvitationDelete,
|
||||
).WithSID("invitation-admin-access"),
|
||||
// Can view SAML configurations
|
||||
policy.Allow(
|
||||
ActionIAMSAMLConfigurationGet,
|
||||
ActionIAMSAMLConfigurationList,
|
||||
).WithSID("saml-viewer-access"),
|
||||
// Can view and update SAML configurations
|
||||
policy.Allow(ActionIAMSAMLConfigurationGet).WithSID("saml-configuration-admin-access"),
|
||||
// Cannot delete organization
|
||||
policy.Deny(ActionIAMOrganizationDelete).WithSID("deny-org-delete"),
|
||||
// Cannot remove members (only owner can)
|
||||
|
||||
@@ -99,6 +99,14 @@ func (s *Service) Run(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) GetEntityID() string {
|
||||
return fmt.Sprintf("%s/connect/saml/metadata", s.baseURL)
|
||||
}
|
||||
|
||||
func (s *Service) GetAcsURL() string {
|
||||
return fmt.Sprintf("%s/connect/saml/consume", s.baseURL)
|
||||
}
|
||||
|
||||
func (s *Service) GenerateSpMetadata() ([]byte, error) {
|
||||
sp := s.baseServiceProvider()
|
||||
return xml.MarshalIndent(sp.Metadata(), "", " ")
|
||||
|
||||
@@ -219,3 +219,31 @@ func (s *Service) GetSession(ctx context.Context, sessionID gid.GID) (*coredata.
|
||||
|
||||
return session, nil
|
||||
}
|
||||
|
||||
func (s *Service) GetSAMLconfiguration(ctx context.Context, samlConfigurationID gid.GID) (*coredata.SAMLConfiguration, error) {
|
||||
var (
|
||||
scope = coredata.NewScopeFromObjectID(samlConfigurationID)
|
||||
samlConfiguration = &coredata.SAMLConfiguration{}
|
||||
)
|
||||
|
||||
err := s.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
err := samlConfiguration.LoadByID(ctx, conn, scope, samlConfigurationID)
|
||||
if err != nil {
|
||||
if err == coredata.ErrResourceNotFound {
|
||||
return saml.NewSAMLConfigurationNotFoundError(samlConfigurationID)
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot load SAML configuration: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return samlConfiguration, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user