Skip to content

vzakharchenko/mikrotik-hotspot-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Keycloak Radius Hotspot

Setup social and other Oauth/Saml integration with Keycloak Radius embedded server

How Keycloak Radius Hotspot works

  1. Authorization through Keycloak occurs by OpenID Connect.
  2. User selects on the login page the identity provider through which he wants to log in
  3. The result of a successful authorization is a JWT that contains a temporary session key.
  4. With this key, the User is authorized through Radius Server.
  5. Radius Server checks if this key is in the user session. And whether it was used.
  6. Radius Server successfully authorizing the user

connection Schema`s

- Cloud connection (Better to Use Radsec)

KeycloakRadius (1)

- Proxy connection

KeycloakRadius

Setup, build and configure HotSpot page for Social Login

  1. Create Realm hotspotRealm
  2. create Radius Client RadiusClientHotSpot
  3. create OpenId client hotspotClient
  4. Setting your Hotspot DNS in "Valid Redirect URIs" and "Web Origins" HotspotClientConfiguration
  5. add "Radius Session Password" Mapper HotSpotMapper HotSpotMapper2
  6. Download keycloak.json downloadKeycloakJson

Setup Mikrotik

  1. Upload all files from hotspot/mikrotik to flash/hotspot on device (authorization.js and login.html)
  • Using web UI
  • Using scp
  • Using ftp
  • Using winbox
  1. Download keycloak.json downloadKeycloakJson
  2. upload keycloak.json into flash/hotspot on device
  3. update Walled Garden. Add your keycloak host addWalledGarden KeycloakHostName

Facebook Login example

  1. Install Keycloak with embedded Radius Server
  2. install ngrok. Register ngrok
    ./ngrok authtoken <YOUR TOKEN>
  3. start ngrok
    ./ngrok http 8090
    Ngrok
  4. open keycloak goto realm and add Facebook Identity Provider SelectFacbook
  5. Copy Redirect URI Copy Redirect URI
  6. goto https://developers.facebook.com/ and create a new application CreateApp1CreateApp2FacebookLogin3Facebook4
  7. Insert Redirect URI from Step 7 Facebook5
  8. Get App Id and Secret from application (Settings->basic) Facebook6
  9. back to Keycloak and set this App Id and Secret Facebook7
  10. add facebook hosts to Walled Garden FacebookWalledGarden
/ip hotspot walled-garden  
add comment=facebook dst-host=facebook.*  
add comment=facebook dst-host=*.facebook.*  
add comment=facebook dst-host=*.fbcdn.*  
add comment=facebook dst-host=*akamai*  
add comment=facebook dst-host=*atdmt*
add comment=facebook dst-host=*fbsbx*
add comment=common dst-host=www.google-analytics.com
  1. open hotspot page FacebookLoginHotspot FacebookLogin2

build UI

build UI Requirements:

node and npm must be installed
macbook instalation brew : brew install node
Install node on ubuntu

Building steps

  1. cd ./source
  2. npm i
  3. npm run build
    result in ./mikrotik