-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauthn.go
42 lines (36 loc) · 949 Bytes
/
authn.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package ayu
import (
"context"
)
// Authenticator is a authentication logic for registration.
type Authenticator interface {
// Authenticate authenticates a client registration.
Authenticate(ctx context.Context, req *AuthnRequest) (*AuthnResponse, error)
}
// AuthnRequest is a request for Authenticator.
type AuthnRequest struct {
RoomID RoomID
ClientID ClientID
ConnectionID connectionID
AuthnMetadata map[string]interface{}
}
// AuthnResponse is a response for Authenticator.
type AuthnResponse struct {
Allowed bool
Reason string
ICEServers []*ICEServer
AuthzMetadata map[string]interface{}
}
type insecureAuthenticator struct{}
func (a *insecureAuthenticator) Authenticate(ctx context.Context, req *AuthnRequest) (*AuthnResponse, error) {
return &AuthnResponse{
Allowed: true,
ICEServers: []*ICEServer{
{
URLs: []string{
"stun:stun.l.google.com:19302",
},
},
},
}, nil
}