1 var selectedSecurityChoice_ =
"";
2 var IDs_ = [
'NoSecurity',
'DigestAccessAuthentication'];
5 state_ = document.getElementById(
"state");
11 var nonSelectedTargetRed;
12 var nonSelectedTargetGreen;
13 var nonSelectedtargetBlue;
19 var selectedTargetRed;
20 var selectedTargetGreen;
21 var selectedtargetBlue;
27 console.log(
"init()");
28 DesktopContent.tooltip(
"Security in the Wiz-Mode",
29 "This is an introduction into the Wiz-Mode Security!" +
31 "There are currently two options for otsdaq Security:" +
32 "\n\t- <b>No Security:</b>\n<INDENT>" +
33 "Just as it sounds, there will be no login required, and all requests " +
34 "will be treated as though they come from fully priveleged administrators. " +
35 "The only security is afforded by keeping your URL unknown (like on a private network)." +
37 "This mode is usually convenient during development when no hardware is at stake." +
39 "\n\t- <b>Digest Access Authentication:</b>\n<INDENT>" +
40 "This is a straightforward username and password approach to security. " +
41 "Included in this selection, when using a HTTPS gateway, is CILOGON certificate access if users associate and email " +
42 "address with their accounts." +
43 "Users can be assigned different levels of access individually." +
45 "This mode, behind the ots HTTPS nodejs gateway, is the recommended <i>otsdaq</i> security approach." +
50 for(var index = 0; index < IDs_.length; index++)
51 selection_[index] = IDs_[index];
54 colorFade(
'orange',
"all");
55 state_= document.getElementById(
"state");
56 state_.innerHTML =
"Loading...";
58 var setSelection=setTimeout(makeServerRequest, 1000);
62 function colorFade(secondColor, which){
67 if(which ==
"selected" || which ==
"all"){
69 if(secondColor ==
'orange'){
70 selectedTargetRed = 255;
71 selectedTargetGreen = 188;
72 selectedTargetBlue = 18;
73 }
else if(secondColor ==
'red'){
74 selectedTargetRed = 242;
75 selectedTargetGreen = 5;
76 selectedTargetBlue = 5;
77 }
else if(secondColor ==
'green'){
78 selectedTargetRed = 56;
79 selectedTargetGreen = 224;
80 selectedTargetBlue = 56;
81 }
else if(secondColor ==
'current'){
86 if(which ==
"notSelected" || which ==
"all"){
88 if(secondColor ==
'orange'){
89 nonSelectedTargetRed = 255;
90 nonSelectedTargetGreen = 188;
91 nonSelectedTargetBlue = 18;
92 }
else if(secondColor ==
'red'){
93 nonSelectedTargetRed = 242;
94 nonSelectedTargetGreen = 5;
95 nonSelectedTargetBlue = 5;
96 }
else if(secondColor ==
'green'){
97 nonSelectedTargetRed = 56;
98 nonSelectedTargetGreen = 224;
99 nonSelectedTargetBlue = 56;
100 }
else if(secondColor ==
'current'){
107 var colorChanger=setTimeout(decreaseColor, INTERVAL_);
112 function decreaseColor(){
115 if(selectedGreen > 0)
119 if(nonSelectedRed > 0)
121 if(nonSelectedGreen > 0)
123 if(nonSelectedBlue > 0)
128 if((selectedRed + selectedGreen + selectedBlue + nonSelectedRed + nonSelectedGreen + nonSelectedBlue) > 0)
129 colorChanger = setTimeout(decreaseColor, INTERVAL_);
132 colorChanger = setTimeout(increaseColor, INTERVAL_);
137 function increaseColor(){
138 if(selectedRed < selectedTargetRed)
140 if(selectedGreen < selectedTargetGreen)
142 if(selectedBlue < selectedTargetBlue)
144 if(nonSelectedRed < nonSelectedTargetRed)
146 if(nonSelectedGreen < nonSelectedTargetGreen)
148 if(nonSelectedBlue < nonSelectedTargetBlue)
152 if((selectedRed + selectedGreen + selectedBlue + nonSelectedRed + nonSelectedGreen + nonSelectedBlue) < (selectedTargetRed + selectedTargetGreen + selectedTargetBlue + nonSelectedTargetRed + nonSelectedTargetGreen + nonSelectedTargetBlue))
153 colorChanger = setTimeout(increaseColor, INTERVAL_);
157 function setDivGlow(){
160 for(var index = 0; index < (selection_.length); index++)
162 var div = document.getElementById(selection_[index]);
163 if(index < (selection_.length-1)){
164 div.style.boxShadow =
"0px 0px 64px 20px rgba(" + nonSelectedRed +
"," + nonSelectedGreen +
"," + nonSelectedBlue +
",1)";
165 div.style.webkitBoxShadow =
"0px 0px 64px 20px rgba(" + nonSelectedRed +
"," + nonSelectedGreen +
"," + nonSelectedBlue +
",1)";
166 div.style.mozBoxShadow =
"0px 0px 64px 20px rgba(" + nonSelectedRed +
"," + nonSelectedGreen +
"," + nonSelectedBlue +
",1)";
168 div.style.boxShadow =
"0px 0px 64px 20px rgba(" + selectedRed +
"," + selectedGreen +
"," + selectedBlue +
",1)";
169 div.style.webkitBoxShadow =
"0px 0px 64px 20px rgba(" + selectedRed +
"," + selectedGreen +
"," + selectedBlue +
",1)";
170 div.style.mozBoxShadow =
"0px 0px 64px 20px rgba(" + selectedRed +
"," + selectedGreen +
"," + selectedBlue +
",1)";
177 function showVisualSelection(){
180 state_.innerHTML =
" ";
183 colorFade(
'green',
'selected');
185 colorFade(
'red',
'notSelected');
189 function confirm(description){
190 var randomNumber = Math.floor(Math.random() * 99999999)
191 if(prompt(
"Are you sure? "+ description +
" Type " + randomNumber +
" to continue:") == randomNumber)
192 if(prompt(
"I know exactly what I'm doing. Type 'I Do':") ==
"I Do"){
193 setSecurity(
'ResetSecurityUserData');
196 alert(
"You did not type 'I Do.' Mission aborted!");
199 alert(
"You did not type the correct number. Mission aborted!");
202 function setSecurity(
id){
204 if(
id ==
'NoSecurity'){
205 console.log(
"No Security selected.")
206 selectedSecurityChoice_ =
'NoSecurity';
207 }
else if(
id ==
'DigestAccessAuthentication'){
208 console.log(
"Digest Access Authentication selcted.")
209 selectedSecurityChoice_=
'DigestAccessAuthentication';
210 }
else if(
id ==
'Kerberos'){
211 console.log(
"Kerberos selected.")
212 selectedSecurityChoice_=
'Kerberos';
213 }
else if(
id ==
'ResetSecurityUserData'){
214 console.log(
"Reset Data selected.")
215 selectedSecurityChoice_=
'ResetSecurityUserData';
217 console.log(
"Selection not recognized!");
222 var serverRequest =
"selection=" + selectedSecurityChoice_;
223 console.log(serverRequest);
224 makeServerRequest(serverRequest);
227 function makeServerRequest(data){
229 DesktopContent.XMLHttpRequest(
"editSecurity", data, editSecurityHandler, undefined, undefined);
232 function restructure(){
234 for(var index = 0; index < IDs_.length; index++)
236 if(selectedSecurityChoice_ !=
"")
238 if(selectedSecurityChoice_ != IDs_[index])
239 selection_[index] = IDs_[index];
242 if(selectedSecurityChoice_ !=
"")
243 selection_[selection_.length] = selectedSecurityChoice_;
247 var editSecurityHandler =
function(req){
249 if(!req || !req.responseText.length)
251 Debug.log(
"Action Failed. Invalid Verify Code!", Debug.HIGH_PRIORITY);
252 selectedSecurityChoice_ =
"";
253 showVisualSelection();
257 if(selectedSecurityChoice_ ==
"ResetSecurityUserData")
258 Debug.log(
"User Data was RESET successfully!", Debug.INFO_PRIORITY);
260 selectedSecurityChoice_ = req.responseText;
261 console.log(selectedSecurityChoice_);
262 showVisualSelection();