@@ -47,7 +47,7 @@ Globs: %s
4747` , aurora .Magenta (aurora .Bold (h .Hostname )), h .Backend , h .Type , h .Public , h .Globs )
4848}
4949
50- func (h * Host ) Validate () (bool , error ) {
50+ func (h * Host ) Validate (cookiescope string ) (bool , error ) {
5151 ok , err := govalidator .ValidateStruct (h )
5252 if ! ok {
5353 return ok , err
@@ -62,6 +62,9 @@ func (h *Host) Validate() (bool, error) {
6262 if ! strings .HasPrefix (u .Scheme , "http" ) {
6363 return false , fmt .Errorf ("%s has invalid or missing scheme" , h .Backend )
6464 }
65+ if ! strings .HasSuffix (h .Hostname , cookiescope ) && ! h .Public {
66+ return false , fmt .Errorf ("'%s' won't be accessible because the cookiescope ('%s') does not match this domain" , h .Hostname , cookiescope )
67+ }
6568 if ! h .Public && len (h .Globs ) == 0 {
6669 return false , fmt .Errorf ("%s will not be accessible by anybody" , h .Hostname )
6770 }
@@ -93,7 +96,16 @@ func (h Host) HasAccess(user string) bool {
9396}
9497
9598func (c * Config ) Validate () (bool , error ) {
96- return govalidator .ValidateStruct (c )
99+ ok , err := govalidator .ValidateStruct (c )
100+ if ! ok {
101+ return ok , err
102+ }
103+
104+ if ! strings .HasSuffix (c .Hostname , c .CookieScope ) {
105+ return false , fmt .Errorf ("Hostname: '%s' should be in the same domain as the cookiescope: '%s'" , c .Hostname , c .CookieScope )
106+ }
107+
108+ return ok , err
97109}
98110
99111func LoadConf (path string ) (Config , error ) {
0 commit comments