HTTP User

HTTP User gives the information about the currently logged in user, if any.

Version 3.x ⚠

Moved to different package security



Version 2.x

Basic Usage

1
2
3
4
5
6
7
8
9
10
/* globals $ */
/* eslint-env node, dirigible */

var user = require('net/http/user');
var response = require('net/http/response');

response.println("[UserName]: " + user.getName());
response.println("[Is in Role]: " + user.isInRole("some_role"));
response.flush();
response.close();

Definition

Functions


Function Description Returns
getName() Returns the name of the currently logged in user, if any or null string
isInRole(role) Returns true if the user has a given role and false otherwise boolean

Compatibility

Rhino Nashorn V8
βœ… βœ… ❌
Edit