token-validator: add missing SSH challenge
This commit is contained in:
parent
7bac1ead6b
commit
0302d30390
@ -30,6 +30,10 @@ func noAccessRestriction(*Student, *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func noAccess(*Student, *http.Request) error {
|
||||
return errors.New("This challenge cannot be accessed this way. ")
|
||||
}
|
||||
|
||||
func accessFrom(ip string) func(_ *Student, r *http.Request) error {
|
||||
return func(_ *Student, r *http.Request) error {
|
||||
if r.Header.Get("X-Forwarded-By") != ip {
|
||||
@ -243,6 +247,9 @@ func init() {
|
||||
},
|
||||
|
||||
/* Last : SSH key, see ssh.go:156 in NewKey function */
|
||||
Challenge{
|
||||
Accessible: []func(*Student, *http.Request) error{noAccess},
|
||||
},
|
||||
}
|
||||
|
||||
router.GET("/challenges", apiHandler(getChallengeList))
|
||||
|
Reference in New Issue
Block a user