Changeset 2b76b5f in guacamole
- Timestamp:
- 04/18/12 15:31:20 (13 months ago)
- Branches:
- master, guacamole-debian-parent, rpm, unstable, unstable-websocket
- Children:
- 923a46a
- Parents:
- 42c8e94
- git-author:
- Michael Jumper <zhangmaike@…> (04/18/12 15:31:20)
- git-committer:
- Michael Jumper <zhangmaike@…> (04/18/12 15:31:20)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/example/user-mapping.xml
r7545277 r2b76b5f 3 3 <!-- Per-user authentication and config information --> 4 4 <authorize username="USERNAME" password="PASSWORD"> 5 6 <!-- Single authorized connection --> 7 <connection name="localhost"> 8 <protocol>vnc</protocol> 9 <param name="hostname">localhost</param> 10 <param name="port">5900</param> 11 <param name="password">VNCPASS</param> 12 </connection> 13 5 <protocol>vnc</protocol> 6 <param name="hostname">localhost</param> 7 <param name="port">5900</param> 8 <param name="password">VNCPASS</param> 14 9 </authorize> 15 10 -
src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java
r42c8e94 r2b76b5f 50 50 * This list is stored in an XML file which is reread if modified. 51 51 * 52 * This is modified version of BasicFileAuthenticationProvider written by Michael Jumper. 53 * 54 * @author Michal Kotas 52 * @author Michael Jumper, Michal Kotas 55 53 */ 56 54 public class BasicFileAuthenticationProvider implements AuthenticationProvider { … … 138 136 // Validate and return info for given user and pass 139 137 AuthInfo info = mapping.get(credentials.getUsername()); 140 if (info != null && info.validate(credentials.getUsername(), credentials.getPassword())) { 141 142 //Map<String, GuacamoleConfiguration> configs = new HashMap<String, GuacamoleConfiguration>(); 143 //configs.put("DEFAULT", info.getConfiguration()); 144 //return configs; 145 146 Map<String, GuacamoleConfiguration> configs = info.getConfigurations(); 147 return configs; 148 } 138 if (info != null && info.validate(credentials.getUsername(), credentials.getPassword())) 139 return info.getConfigurations(); 149 140 150 141 // Unauthorized … … 228 219 229 220 public GuacamoleConfiguration getConfiguration(String name) { 230 //return configs; 231 return configs.get(name); 232 } 221 222 // Create new configuration if not already in map 223 GuacamoleConfiguration config = configs.get(name); 224 if (config == null) { 225 config = new GuacamoleConfiguration(); 226 configs.put(name, config); 227 } 228 229 return config; 230 231 } 232 233 233 public Map<String, GuacamoleConfiguration> getConfigurations() { 234 234 return configs; 235 }236 public void addConfiguration(String name) {237 configs.put(name, new GuacamoleConfiguration());238 235 } 239 236 … … 251 248 ROOT, 252 249 USER_MAPPING, 250 251 /* Username/password pair */ 252 AUTH_INFO, 253 254 /* Connection configuration information */ 253 255 CONNECTION, 254 AUTH_INFO,255 256 PROTOCOL, 256 257 PARAMETER, 258 259 /* Configuration information associated with default connection */ 260 DEFAULT_CONNECTION_PROTOCOL, 261 DEFAULT_CONNECTION_PARAMETER, 262 257 263 END; 258 264 } … … 315 321 if (localName.equals("param")) { 316 322 state = State.CONNECTION; 323 return; 324 } 325 326 break; 327 328 case DEFAULT_CONNECTION_PROTOCOL: 329 330 if (localName.equals("protocol")) { 331 state = State.AUTH_INFO; 332 return; 333 } 334 335 break; 336 337 case DEFAULT_CONNECTION_PARAMETER: 338 339 if (localName.equals("param")) { 340 state = State.AUTH_INFO; 317 341 return; 318 342 } … … 378 402 throw new SAXException("Attribute \"name\" required for connection tag."); 379 403 380 current.addConfiguration(currentConnection); 404 // Next state 405 state = State.CONNECTION; 406 return; 407 } 408 409 if (localName.equals("protocol")) { 410 411 // Associate protocol with default connection 412 currentConnection = "DEFAULT"; 381 413 382 414 // Next state 383 state = State.CONNECTION; 415 state = State.DEFAULT_CONNECTION_PROTOCOL; 416 return; 417 } 418 419 if (localName.equals("param")) { 420 421 // Associate parameter with default connection 422 currentConnection = "DEFAULT"; 423 424 currentParameter = attributes.getValue("name"); 425 if (currentParameter == null) 426 throw new SAXException("Attribute \"name\" required for param tag."); 427 428 // Next state 429 state = State.DEFAULT_CONNECTION_PARAMETER; 384 430 return; 385 431 }
Note: See TracChangeset
for help on using the changeset viewer.
