Authentication system - OpenMarshal/npm-WebDAV-Server GitHub Wiki
The authentication system is based on the HTTP authentication system.
It uses the Authorization
and WWW-Authenticate
headers to provide authentication.
At the moment, only two authentication systems are available :
- Basic
- Digest
Thanks to the server's option httpAuthentication
, it is possible to define a custom authentication system.
It musts inherit from the interface HTTPAuthentication
:
interface HTTPAuthentication
{
realm : string
askForAuthentication() : any
getUser(arg : MethodCallArgs, userManager : IUserManager, callback : (error : Error, user : IUser) => void)
}
The askForAuthentication()
method is used by the server to know what headers the method needs to add to its response.
The getUser()
method is used by the server to get the user of the current request.
There are two authentication system implemented in the modules : HTTPBasicAuthentication
and HTTPDigestAuthentication
.
The class HTTPBasicAuthentication
implements the Basic
authentication system.
The class HTTPDigestAuthentication
implements the Digest
authentication system and provides a more secure way to authenticate.