Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- before(function(){
- system.use("info.webtoolkit.Base64");
- var username = 'foo';
- var password = 'bar';
- var auth = "Basic " + Base64.encode(username + ":"+ password);
- if (!this.request.headers.hasOwnProperty('Authorization') || (this.request.headers.hasOwnProperty('Authorization') && (auth != this.request.headers['Authorization']))) {
- this.response.headers['WWW-Authenticate'] = 'Basic realm="Protected Area"';
- this.response.code = 401;
- this.response.body = "Not Authorized\n";
- throw this.response;
- }
- });
Add Comment
Please, Sign In to add comment