goradius

package module
v0.0.0-...-23c72c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2017 License: MIT Imports: 9 Imported by: 7

README

goradius

Build Status GoDoc

Description

goradius package implements basic Radius client capabilities, allowing Go code to authenticate against a Radius server. It is based on https://github.com/btimby/py-radius python package

Installation

To install this package simply:

go get github.com/kirves/goradius

Test

Before testing goradius fill the necessary data in the goradius_test.go file (server url, secret, username and password to test the client).

After that, simply run:

go test github.com/kirves/goradius

Example

To authenticate a user simply create a new AuthenticatorT object using server information and the secret associated to your client

auth := goradius.Authenticator(server_url, server_port, secret)

And try to authenticate a user:

ok, err := auth.Authenticate(username, password, nasId)
if err != nil {
	panic(err)
}
if ok {
	// user successfully authenticated
}

License

goradius is released under the MIT license. See LICENSE.

Documentation

Overview

Package goradius implements basic Radius client capabilities, allowing Go code to authenticate against a Radius server. It is based on https://github.com/btimby/py-radius Python package

Index

Constants

View Source
const (
	// AccessRequest packet id
	AccessRequest = iota + 1
	// AccessAccept packet id
	AccessAccept
	// AccessReject packet id
	AccessReject

	// RETRIES is the number of login retries
	RETRIES = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatorT

type AuthenticatorT struct {
	// contains filtered or unexported fields
}

The AuthenticatorT object implements the Authenticate method to check whether a user can authenticate against the provided server

func Authenticator

func Authenticator(server, port, secret string) *AuthenticatorT

Authenticator method returns a new AuthenticatorT object, providing the server url and port and the secret associated to the client (registered on the server).

func AuthenticatorWithTimeout

func AuthenticatorWithTimeout(server, port, secret string, timeout time.Duration) *AuthenticatorT

AuthenticatorWithTimeout method returns a new AuthenticatorT object, providing the server url, the port, the secret and a timeout associated to the client (registered on the server).

func (*AuthenticatorT) Authenticate

func (a *AuthenticatorT) Authenticate(username, password, nasID string) (bool, error)

Authenticate authenticates a user against the Radius server and returns true whether the user provided the correct password If nasId is empty this attribute won't be included in request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL