- String prefix = state.substring(0, firstSlash);
- String path = state.substring(firstSlash);
- if (session.nodeExists(path))
- node = session.getNode(path);
- else
- throw new CmsException("Data " + path + " does not exist");
- page = prefix;
+ prefix = state.substring(0, firstSlash);
+ newNodePath = state.substring(firstSlash);
+ } else {
+ newNodePath = defaultPath;
+ prefix = state;
+
+ }
+
+ // auth
+ int colonIndex = prefix.indexOf('$');
+ if (colonIndex > 0) {
+ // String user = prefix.substring(0, colonIndex);
+ // // if (isAnonymous()) {
+ // String token = prefix.substring(colonIndex + 1);
+ // LoginContext lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, new
+ // CallbackHandler() {
+ //
+ // @Override
+ // public void handle(Callback[] callbacks) throws IOException,
+ // UnsupportedCallbackException {
+ // for (Callback callback : callbacks) {
+ // if (callback instanceof NameCallback)
+ // ((NameCallback) callback).setName(user);
+ // else if (callback instanceof PasswordCallback)
+ // ((PasswordCallback) callback).setPassword(token.toCharArray());
+ // }
+ //
+ // }
+ // });
+ SharedSecret token = new SharedSecret(new AuthPassword(X_SHARED_SECRET + '$' + prefix));
+ LoginContext lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, token);
+ lc.login();
+ authChange(lc);// sets the node as well
+ // } else {
+ // // TODO check consistency
+ // }