|
|
@@ -1,8 +1,11 @@
|
|
|
package test
|
|
|
|
|
|
import (
|
|
|
+ "strings"
|
|
|
+
|
|
|
"github.com/porter-dev/porter/internal/models/saml"
|
|
|
"github.com/porter-dev/porter/internal/repository"
|
|
|
+ "gorm.io/gorm"
|
|
|
)
|
|
|
|
|
|
// SAMLIntegrationRepository implements repository.SAMLIntegrationRepository
|
|
|
@@ -20,11 +23,15 @@ func NewSAMLIntegrationRepository(canQuery bool) repository.SAMLIntegrationRepos
|
|
|
}
|
|
|
|
|
|
func (repo *SAMLIntegrationRepository) ValidateSAMLIntegration(domain string) (*saml.SAMLIntegration, error) {
|
|
|
- integ := &saml.SAMLIntegration{}
|
|
|
-
|
|
|
- // TODO: fix test query
|
|
|
+ for _, integ := range repo.integrations {
|
|
|
+ for _, d := range strings.Split(integ.Domains, ",") {
|
|
|
+ if d == domain {
|
|
|
+ return integ, nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return integ, nil
|
|
|
+ return nil, gorm.ErrRecordNotFound
|
|
|
}
|
|
|
|
|
|
func (repo *SAMLIntegrationRepository) CreateSAMLIntegration(integ *saml.SAMLIntegration) (*saml.SAMLIntegration, error) {
|