Skip to content

GovWifi/govwifi-authentication-api

Repository files navigation

GovWifi Authentication API

This API is used by the frontend when a connection request is made to GovWifi. Its function is to check these requests against user details and the result determines how FreeRADIUS reacts to it e.g. allow / dissallow the connection.

N.B. The private GovWifi build repository contains instructions on how to build GovWifi end-to-end - the sites, services and infrastructure.

Table of Contents

Overview

GovWifi exposes FreeRADIUS servers on public IP addresses, which are configured to communicate with this private API via its REST plugin.

Sinatra routes

  • GET /authorize/user/:user_name - FreeRADIUS authorisation route

Dependencies

  • MySQL database - user details generated by the user signup API are fetched by this API.

Developing

The Makefile contains commonly used commands for working with this app:

  • make test runs all the automated tests.
  • make serve starts the API server on localhost.
  • make shell starts the API server, then opens a shell in its docker container.

Deploying changes

Merging to master will automatically deploy this API to staging. You can find in depth instructions on using our deploy process here (you must be member of the GovWifi Team to access this document).

Gotchas

Extra API parameters

let(:url) { "/authorize/user/#{username}/mac/#{client_mac}/ap/#{ap_mac}/site/#{ap_ip_address}/apg/#{ap_aruba_name}/mdn/#{ap_meraki_name}" }

Currently we do not use any of the above parameters after username within any part of the API code. However having these parameters in the CloudWatch logs is useful for linking up matching requests between the /authorize and /post-auth calls while debugging.

Licence

This codebase is released under the MIT License.