Home
Author Manual
Builder Manual
Development
Install fpm
Update fpm
Create new fpm project
Create new fpm project on github
Build fpm project locally
Publishing On Github pages
Publishing On Vercel
Use Favicon
Custom Fonts
Create Font Package
Auth Testing

Auth Testing
In this article, I am using abrark.com package for remote and local testing.

Local Testing with CLI Parameter --identities
For authorization purpose we have to define user groups in FPM.ftd.

Define User Group in FPM.ftd
In the below group using email as identity.

FPM.ftd
-- fpm.user-group: abrark-readers
email: abrark.asahi@gmail.com

Use User Group in Sitemap
Use abrark-readers in Sitemap with readers key.

FPM.ftd
-- fpm.sitemap:

# Home: /
readers: abrark-readers

Build fpm Binary
Clone FifthTry/fpm and build it.

cargo install --path=.

Run fpm with CLI Parameter --identities

By setting --identities as email: abrark.asahi@gmail.com we are saying that at every http request this email is the user identity and check the permission against this user identity.

Run fpm with cli parameter --identities in your package.

fpm serve --port 8000 --identities 'email: abrark.asahi@gmail.com'
Open / in the browser, It will let access to / page. If you will change email identity in FPM.ftd to other email and reload page again, so it will show unauthorized access.

Define User Group in FPM.ftd
In the below group using email as identity.

FPM.ftd
-- fpm.user-group: abrark-readers
email: abrark.asahi@gmail.com

Use User Group in Sitemap
Use abrark-readers in Sitemap with readers key.

FPM.ftd
-- fpm.sitemap:

# Home: /
readers: abrark-readers

Build fpm Binary
Clone FifthTry/fpm and build it.

cargo install --path=.

Run fpm
Run fpm binary in your package.

fpm serve --port 8000

Define User Group in FPM.ftd
In the below group using github-like as identity.

FPM.ftd
-- fpm.user-group: abrark-readers
github-like: AbrarNitk/abrark

Use User Group in Sitemap
Use abrark-readers in Sitemap with readers key.

FPM.ftd
-- fpm.sitemap:

# Home: /
readers: abrark-readers

OAuth Login with GitHub

Open link https://abrark.com/-/dj/login/github/ in browser and complete the OAuth login flow and provide permissions to FifthTry to access your GitHub APIs.

It will redirect to GitHub login page.

GitHub Login

Click on Sign in, and complete Two-factor if any.

It will redirect to authorize page.

GitHub Authorize 5thtry

Click on Authorize FifthTry, after that you will be redirected to abrark.com.

Check GET API https://abrark.com/-/dj/get-identities/, It will give below response.

{
    "success": true,
    "user-identities": [{"github": "AbrarNitk"}]
}

Now copy sid cookie from https://abrark.com/ and paste it in http://127.0.0.1:8000 cookie with sid key.

Note: Go to fpm::controller::get_remote_identities and change remote_host in fpm, to abrark.com.

Build fpm with Remote Feature

cargo install --path=. --features remote

Run fpm
Run fpm binary in your package.

fpm serve --port 8000

Now go to AbrarNitk/abrark repository and give a star, you should be able access / document. If you undo star and access it again it will give unauthorized access.

Yay!!! Such a magic it is. 💫