06-21-2007 05:39 AM
package com.wannakey.user;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.scripts.DeclarativeWebScript;
import org.alfresco.web.scripts.WebScriptRequest;
import org.alfresco.web.scripts.WebScriptStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.web.scripts.WebScriptException;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
public class SignIn extends DeclarativeWebScript {
// Logger
private static final Log log = LogFactory.getLog(SignIn.class);
// dependencies
private AuthenticationService authenticationService;
/**
* @param authenticationService
*/
public void setAuthenticationService(AuthenticationService authenticationService)
{
this.authenticationService = authenticationService;
}
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, WebScriptStatus status) {
if (authenticationService == null) {
log.debug("Signin.executeImpl authenticationService is null");
} else {
log.debug("Signin.executeImpl authenticationService is NOT null");
}
log.debug("Signin.executeImpl called CurrentUser=" + authenticationService.getCurrentUserName());
String email = req.getParameter("email");
String password = req.getParameter("password");
if ((email == null) || (email.length() == 0)) {
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "email not specified");
}
if ((password == null) || (password.length() == 0)) {
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Password not specified");
}
try
{
// get ticket
authenticationService.authenticate(email, password.toCharArray());
// add ticket to model for javascript and template access
Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
model.put("ticket", authenticationService.getCurrentTicket());
return model;
}
catch(AuthenticationException e)
{
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Signin failed");
}
finally
{
authenticationService.clearCurrentSecurityContext();
}
}
}
<webscript>
<shortname>signin</shortname>
<description>Sign in with your wannakey-account</description>
<url>/user/signin?email={email}&password={password}</url>
<format default="xml"/>
<authentication>none</authentication>
<transaction>required</transaction>
</webscript>
<?xml version="1.0" encoding="UTF-8"?>
<ticket>${ticket}</ticket>
<bean id="webscript.com.wannakey.signin.get"
class="com.wannakey.user.SignIn" parent="webscript"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default">
<property name="authenticationService" ref="authenticationService" />
</bean>
06-21-2007 06:05 AM
log4j.logger.org.alfresco.web.scripts=debug
log4j.properties
06-21-2007 06:14 AM
06-21-2007 06:26 AM
webscript.<packageId>.<serviceId>.<httpMethod>
org/alfresco/repository
org.alfresco.repository
webscript.org.alfresco.repository.login.get
06-21-2007 07:11 AM
01-02-2008 04:59 PM
12:45:37,533 ERROR [[Catalina].[localhost].[/alfresco]] Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.tsgrp.alfresco.webscript.SignInWebScript] for bean with name 'webscript.com.tsgrp.signin.get' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\auth-context.xml]; nested exception is java.lang.ClassNotFoundException: com.tsgrp.alfresco.webscript.SignInWebScript
Caused by:
java.lang.ClassNotFoundException: com.tsgrp.alfresco.webscript.SignInWebScript
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:183)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:317)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1044)
at org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1072)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165)
at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:691)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:395)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
01-07-2008 10:47 AM
01-07-2008 11:45 AM
01-07-2008 11:52 AM
<bean id="webscript.com.tsgrp.signin.get" class="com.tsgrp.alfresco.webscript.SignInWebScript" parent="webscript"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default">
<property name="authenticationService" ref="authenticationService" />
</bean>
01-07-2008 12:37 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.