split checker from token-validator
This commit is contained in:
parent
685dc0b0ea
commit
0c661f36f6
20 changed files with 634 additions and 748 deletions
27
libadlin/domain.go
Normal file
27
libadlin/domain.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package adlin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
AssociatedDomainSuffix = "adlin2021.p0m.fr."
|
||||
DelegatedDomainSuffix = "srs.p0m.fr."
|
||||
)
|
||||
|
||||
func (student Student) MyDelegatedDomain() string {
|
||||
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), DelegatedDomainSuffix)
|
||||
}
|
||||
|
||||
func (student Student) MyAssociatedDomain() string {
|
||||
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), AssociatedDomainSuffix)
|
||||
}
|
||||
|
||||
func (student Student) GetAssociatedDomains() (ds []string) {
|
||||
studentDomain := student.MyAssociatedDomain()
|
||||
|
||||
ds = append(ds, studentDomain)
|
||||
|
||||
return
|
||||
}
|
||||
Reference in a new issue