aws S3Client

This commit is contained in:
kkb0318
2024-03-28 21:41:09 +09:00
parent 022c561938
commit babd997d3b
6 changed files with 340 additions and 206 deletions
+4 -27
View File
@@ -1,35 +1,12 @@
package selfhosted
import "fmt"
type OIDCIdProvider interface {
Discovery() string
JWK() string
Discovery() []byte
JWK() []byte
Endpoint() string
}
type OIDCIdPCreator interface {
CreateStorage() error
Upload(o OIDCIdProvider) error
CreateProvider() error
}
type S3IdPCreator struct {
region string
bucketName string
}
func (s *S3IdPCreator) CreateProvider() error {
// create S3 Bucket // bucketName, Region
// create OIDCProvider //
return nil
}
func (s *S3IdPCreator) Upload(o OIDCIdProvider) error {
o.Discovery() // Upload to Endpoint()/.well-known/openid-configuration
o.JWK() // Upload to Endpoint()/keys.json
return nil
}
func (s *S3IdPCreator) issuerHostPath() string {
hostName := fmt.Sprintf("s3-%s.amazonaws.com", s.region)
return fmt.Sprintf("%s/%s", hostName, s.bucketName)
}