secret deletion

This commit is contained in:
kkb0318
2024-04-11 20:59:17 +09:00
parent 720bc912b9
commit 1b9ccebbc5
13 changed files with 155 additions and 65 deletions
+2
View File
@@ -11,6 +11,7 @@ type OIDCIdP interface {
Create(ctx context.Context) (string, error)
IsUpdate() (bool, error)
Update(ctx context.Context) error
Delete(ctx context.Context) error
}
type OIDCIdPDiscoveryContents interface {
@@ -22,6 +23,7 @@ type OIDCIdPDiscoveryContents interface {
type OIDCIdPDiscovery interface {
CreateStorage(ctx context.Context) error
Upload(ctx context.Context, o OIDCIdPDiscoveryContents) error
DeleteStorage(ctx context.Context) error
}
type OIDCIdPFactory interface {
+5
View File
@@ -32,3 +32,8 @@ func (a *AwsIdP) Update(ctx context.Context) error {
func (a *AwsIdP) IsUpdate() (bool, error) {
return false, nil
}
func (a *AwsIdP) Delete(ctx context.Context) error {
// TODO:
return nil
}
@@ -59,3 +59,9 @@ func (s *S3IdPDiscovery) Upload(ctx context.Context, o selfhosted.OIDCIdPDiscove
}
return nil
}
// DeleteStorage delete an S3 bucket
func (s *S3IdPDiscovery) DeleteStorage(ctx context.Context) error {
// TODO:
return nil
}
+18
View File
@@ -24,3 +24,21 @@ func Execute(ctx context.Context, factory OIDCIdPFactory) error {
}
return nil
}
func Delete(ctx context.Context, factory OIDCIdPFactory) error {
issuerMeta := factory.IssuerMeta()
discovery := factory.IdPDiscovery()
idp, err := factory.IdP(issuerMeta)
if err != nil {
return err
}
err = discovery.DeleteStorage(ctx)
if err != nil {
return err
}
err = idp.Delete(ctx)
if err != nil {
return err
}
return nil
}