daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Oct 16th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component {
  2.     this.name = "wspreso_example7";
  3.     this.wschannels = [{name="news",cfclistener:"newsHandler"}];
  4.  
  5.     public boolean function onApplicationStart() {
  6.         return true;
  7.     }
  8.  
  9.     public boolean function onRequestStart(string req) {
  10.         if(structKeyExists(url,"init")) {
  11.             applicationStop();
  12.             location(url="index.cfm",addToken="false");
  13.         }
  14.         return true;
  15.     }
  16.  
  17.     public boolean function onWSAuthenticate(string username, string password, struct connectionInfo) {
  18.         writelog(file="application", text="onWSAuth called. #serializeJSON(arguments)#");
  19.         if(username == "admin" || username == "bob") {
  20.             connectionInfo.authenticated=true;
  21.  
  22.             //random additional key
  23.             connectionInfo.starwars = 1;
  24.  
  25.             if(username == "admin") connectionInfo.role = "admin";
  26.  
  27.             return true;
  28.         } else {
  29.             return false;
  30.         }
  31.        
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top