keys, oidcIdP

This commit is contained in:
kkb0318
2024-03-26 21:25:25 +09:00
parent e33ea809f0
commit 022c561938
5 changed files with 195 additions and 56 deletions
+34
View File
@@ -1 +1,35 @@
package selfhosted
import "fmt"
type OIDCIdProvider interface {
Discovery() string
JWK() string
Endpoint() string
}
type OIDCIdPCreator interface {
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)
}