feat: check if org exists (#480)

* feat: check if org exists

* feat: check if org exists

* Update internal/authz/repository/eventsourcing/eventstore/token_verifier.go

Co-authored-by: Silvan <silvan.reusser@gmail.com>

* fix: err handling

Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
Fabi
2020-07-16 13:27:36 +02:00
committed by GitHub
parent 423b86a03b
commit 5e00f1c9db
10 changed files with 152 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ type authZRepo interface {
VerifierClientID(ctx context.Context, name string) (clientID string, err error)
ResolveGrants(ctx context.Context) (grant *Grant, err error)
ProjectIDByClientID(ctx context.Context, clientID string) (projectID string, err error)
ExistsOrg(ctx context.Context, orgID string) error
}
func Start(authZRepo authZRepo) (v *TokenVerifier) {
@@ -91,6 +92,10 @@ func (v *TokenVerifier) GetProjectIDByClientID(ctx context.Context, clientID str
return v.authZRepo.ProjectIDByClientID(ctx, clientID)
}
func (v *TokenVerifier) ExistsOrg(ctx context.Context, orgID string) error {
return v.authZRepo.ExistsOrg(ctx, orgID)
}
func (v *TokenVerifier) CheckAuthMethod(method string) (Option, bool) {
authOpt, ok := v.authMethods[method]
return authOpt, ok