mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: support radius accounting request (#2362)
* feat: add radius server * feat: parse org from packet * feat: add comment * feat: support radius accounting * feat: change log * feat: add copyright
This commit is contained in:
@ -29,11 +29,7 @@ func TestAccessRequestRejected(t *testing.T) {
|
||||
packet := radius.New(radius.CodeAccessRequest, []byte(`secret`))
|
||||
rfc2865.UserName_SetString(packet, "admin")
|
||||
rfc2865.UserPassword_SetString(packet, "12345")
|
||||
vsa, err := radius.NewVendorSpecific(OrganizationVendorID, []byte("built-in"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
packet.Add(rfc2865.VendorSpecific_Type, vsa)
|
||||
rfc2865.Class_SetString(packet, "built-in")
|
||||
response, err := radius.Exchange(context.Background(), packet, "localhost:1812")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@ -47,11 +43,7 @@ func TestAccessRequestAccepted(t *testing.T) {
|
||||
packet := radius.New(radius.CodeAccessRequest, []byte(`secret`))
|
||||
rfc2865.UserName_SetString(packet, "admin")
|
||||
rfc2865.UserPassword_SetString(packet, "123")
|
||||
vsa, err := radius.NewVendorSpecific(OrganizationVendorID, []byte("built-in"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
packet.Add(rfc2865.VendorSpecific_Type, vsa)
|
||||
rfc2865.Class_SetString(packet, "built-in")
|
||||
response, err := radius.Exchange(context.Background(), packet, "localhost:1812")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Reference in New Issue
Block a user