This installable Nextcloud App provides 2-factor authentication for Web-eID solution.
Currently it is supposed to run with InfinitEID solution, but with easy implementation of authenticate function it also works with other Web-eID compatible cards.
Usage (after installation from Nextcloud App Store)
- Use OCC command to enable this app (to register it):
occ app:enable twofactor_webeid
- Use OCC command to enable this app for specific user:
occ twofactorauth:enable <userID> twofactor_webeid
- Use OCC command to specify a subject CN loaded on the on-card user certificate:
occ user:setting <userID> twofactor_webeid subject_cn "<user subject CN>"
- (Optional) Add trusted certificates into
/trustedcerts
- Clone this repository into
<nextcloud-path>/appsdirectory - (IMPORTANT) Rename this application folder from
nextcloud_twofactor_webeidtotwofactor_webeid. - Install authtoken validation library by
composer install(checkcomposer.jsonfor require details) - Check function
lib/Service/WebEidService.php:authenticate()and implement other authentication mechanism if needed - Use OCC command to enable this app (to register it):
occ app:enable twofactor_webeid
- Use OCC command to enable this app for specific user:
occ twofactorauth:enable <userID> twofactor_webeid
- Use OCC command to specify a subject CN loaded on the on-card user certificate:
occ user:setting <userID> twofactor_webeid subject_cn "<user subject CN>"
- After specified
<userID>logins with username+password, he is asked to insert card into reader and click on Authenticate button - Add trusted certificates into
/trustedcerts - Web-eID authenticaton process is executed
The following list describes all relevant code that need to be implemented in order to authenticate via Web-eID using PHP validation library installed by Composer:
js/web-eid-challenge.js- adds handler on button click which calls relevant methods fromweb-eid.js(see official documentation for more details)lib/Provider/WebEidProvider.php:getTemplate() and verifyChallenge()- high level functions for obtaining challenge and verifying authtokenlib/Service/WebEidConfig.php- few configuration values required by Web-eID librarylib/Service/WebEidService.php- low level functions for providing Web-eID objectslib/Service/SessionBackedChallengeNonceStore.php- example implementation of challenge nonce store using built-in Nextcloud session objecttemplates/WebEidChallenge.php- prepared html page containing a form withchallengeinput, which is sent toverifyChallenge()function by Nextcloud