If the header does not exist in the HTTP request then a null object is returned, otherwise the username and password are extract from the header and used to populate the com.ebasetech.xi.services.auth.UserCredentials object.
Further documentation.
Javascript example:
var authenticated = false; var cred = form.rest.readBasicAuthenticationCredentials(); if(cred) { //authenticate user if(cred.getUsername() == "demouser" && cred.getPassword() == "demopwd") { authenticated = true; } else { //send back forbidden status form.rest.setStatus(403); } } else { //send back 401 status and WWW-Authenticate header form.rest.setResponseHeader("WWW-Authenticate", "Basic realm=\"My Realm\""); form.rest.setStatus(401); } if(authenticated) { // do something }
returns UserCredentials
If the header does not exist in the HTTP request then a null object is returned, otherwise the username and password are extract from the header and used to populate the com.ebasetech.xi.services.auth.UserCredentials object.
Further documentation.
Javascript example: