04-18-2013 12:50 AM
<config evaluator="string-compare" and the condition="Remote">
sections.
<config evaluator="string-compare" condition="Remote">
<remote>
<endpoint>
<id>alfresco-noauth</id>
<name>Alfresco - unauthenticated access</name>
<description>Access to Alfresco Repository WebScripts that do not
require authentication
</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>none</identity>
</endpoint>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that
require user authentication
</description>
<connector-id>alfresco</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-feed</id>
<name>Alfresco Feed</name>
<description>Alfresco Feed - supports basic HTTP authentication via
the EndPointProxyServlet</description>
<connector-id>http</connector-id>
<endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
<basic-auth>true</basic-auth>
<identity>user</identity>
</endpoint>
<endpoint>
<id>activiti-admin</id>
<name>Activiti Admin UI - user access</name>
<description>Access to Activiti Admin UI, that requires user
authentication</description>
<connector-id>activiti-admin-connector</connector-id>
<endpoint-url>http://localhost:8080/alfresco/activiti-admin
</endpoint-url>
<identity>user</identity>
</endpoint>
</remote>
</config>
<config evaluator="string-compare" condition="Remote">
<remote>
<keystore>
<path>alfresco/web-extension/alfresco-system.p12</path>
<type>pkcs12</type>
<password>alfresco-system</password>
</keystore>
<connector>
<id>alfrescoCookie</id>
<name>Alfresco Connector</name>
<description>Connects to an Alfresco instance using cookie-based
authentication
</description>
<class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
</connector>
<connector>
<id>alfrescoHeader</id>
<name>Alfresco Connector</name>
<description>Connects to an Alfresco instance using header and
cookie-based authentication
</description>
<class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
<userHeader>SsoUserHeader</userHeader>
</connector>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user
authentication
</description>
<connector-id>alfrescoHeader</connector-id>
<endpoint-url>http://localhost:8080/alfresco/wcs</endpoint-url>
<identity>user</identity>
<external-auth>true</external-auth>
</endpoint>
</remote>
</config>
Testing SSO <br>
<%
URL url1 = new URL("http://localhost:8080/share/page");
URLConnection conn = url1.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestProperty("SsoUserHeader", "admin");
for (int i = 0;; i++) {
String headerName = conn.getHeaderFieldKey(i);
String headerValue = conn.getHeaderField(i);
System.out.println(headerName + "===");
System.out.println(headerValue);
if (headerName == null && headerValue == null) { break; }
}
%>
***************
null===
HTTP/1.1 200 OK
Server===
Apache-Coyote/1.1
Set-Cookie===
JSESSIONID=89E6C0A9600DDA3675EEB633F5F3A248; Path=/share/; HttpOnly
Cache-Control===
no-cache
Content-Type===
text/html;charset=utf-8
Content-Language===
en-US
Transfer-Encoding===
chunked
Date===
Wed, 17 Apr 2013 13:52:24 GMT
null===
null
*************
05-30-2013 06:22 AM
if (getCredentials() != null)
{
// if this connector is managing session info
if (getConnectorSession() != null)
{
// apply alfresco ticket from connector session - i.e. previous login attempt
alfTicket = (String)getConnectorSession().getParameter(AlfrescoAuthenticator.CS_PARAM_ALF_TICKET);
}
}
06-06-2013 01:34 AM
1. getticket.get.desc.xml
<webscript>
<shortname>GET QDRIVE TICKET</shortname>
<description>Getting QdriveTicket</description>
<url>/getticket</url>
<authentication>user</authentication>
<negotiate accept="text/html">html</negotiate>
<negotiate accept="application/json">json</negotiate>
</webscript>
2.getticket.get.json.ftl
${session.getTicket()}
org.springframework.extensions.webscripts.WebScriptException: 05060001 Web Script org/alfresco/repository/store/remoteadm.post
requires user authentication; however, a guest has attempted access.
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:321)
at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:303)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:433)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:345)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68)
at sun.reflect.GeneratedMethodAccessor384.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy236.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:140)
at sun.reflect.GeneratedMethodAccessor384.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy236.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
06-07-2013 02:55 AM
public class SlingshotAlfrescoConnector extends RequestCachingConnector
{
private static final String CD_USER_HEADER = "userHeader";
public static final String CS_PARAM_USER_HEADER = "userHeader";
public SlingshotAlfrescoConnector(ConnectorDescriptor descriptor, String endpoint) {
super(descriptor, endpoint);
}
private String getUserHeader() {
String userHeader = descriptor.getStringProperty(CD_USER_HEADER);
System.out.println("userHeader : " + userHeader);
if (userHeader != null && userHeader.trim().length() == 0) {
userHeader = null;
}
return userHeader;
}
@Override
public void setConnectorSession(ConnectorSession connectorSession) {
super.setConnectorSession(connectorSession);
connectorSession.setParameter(CS_PARAM_USER_HEADER, getUserHeader());
System.out.println(" connectorSession : " + connectorSession);
}
protected void applyRequestHeaders(RemoteClient remoteClient, ConnectorContext context) {
super.applyRequestHeaders(remoteClient, context);
Map<String, String> headers = new HashMap<String, String>(8);
if (context != null) {
headers.putAll(context.getHeaders());
}
if (getCredentials() != null) {
String user = (String) getCredentials().getProperty(Credentials.CREDENTIAL_USERNAME);
String pass = (String) getCredentials().getProperty(Credentials.CREDENTIAL_PASSWORD);
if (pass == null) {
headers.put("X-Alfresco-Remote-User", user);
System.out.println("X-Alfresco-Remote-User " + user);
}
String userHeader = getUserHeader();
if (userHeader != null) {
System.out.println("getUserHeader Not NULL: " + userHeader);
headers.put(userHeader, user);
}
}
String alfTicket = null;
if (getConnectorSession() != null) {
System.out.println("getConnectorSession() not NULL");
// apply alfresco ticket from connector session - i.e. previous login attempt
alfTicket = (String)getConnectorSession().getParameter(AlfrescoAuthenticator.CS_PARAM_ALF_TICKET);
// added some codes here written in above if condition :- if (getCredentials() != null).
System.out.println("alfTicket : " + alfTicket);
String user = "admin";
headers.put("X-Alfresco-Remote-User", user);
System.out.println("X-Alfresco-Remote-User Now : " + user);
String userHeader = getUserHeader();
if (userHeader != null) {
System.out.println("getUserHeader NOW : " + userHeader);
headers.put(userHeader, "admin");
}
}
// Additionally Setting ticket in the remoteClient as done in AlfrescoConnector.java class
if (alfTicket != null) {
System.out.println("Setting alf_ticket : " + alfTicket);
remoteClient.setTicket(alfTicket);
remoteClient.setTicketName("alf_ticket");
}
// stamp all headers onto the remote client
if (headers.size() != 0) {
System.out.println("size!=0");
remoteClient.setRequestProperties(headers);
}
}
}
FILTER IS EXECUTING-PRE
Initializing the SpecialSSOFilter. Ticket : TICKET_b5df0646f39c9b3bed6f29838990af7fbe1143d3
connectorService : org.springframework.extensions.webscripts.connector.ConnectorService@4ec4073f
connectorSession : org.springframework.extensions.webscripts.connector.ConnectorSession@3022d2c1
ALF_TICKET TICKET_b5df0646f39c9b3bed6f29838990af7fbe1143d3
userHeader : SsoUserHeader
connectorSession : org.springframework.extensions.webscripts.connector.ConnectorSession@3022d2c1
getConnectorSession() not NULL
alfTicket : TICKET_b5df0646f39c9b3bed6f29838990af7fbe1143d3
X-Alfresco-Remote-User Now : admin
getUserHeader NOW : SsoUserHeader
Setting alf_ticket : TICKET_b5df0646f39c9b3bed6f29838990af7fbe1143d3
size!=0
FILTER IS EXECUTING-POST
06-03-2013 12:47 AM
06-10-2013 04:02 AM
06-11-2013 10:32 AM
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user
authentication
</description>
<connector-id>alfrescoHeader</connector-id>
<endpoint-url>http://localhost:8080/alfresco/wcs</endpoint-url>
<identity>user</identity>
<external-auth>true</external-auth>
</endpoint>
remoteClient.setTicket(alfTicket);
remoteClient.setTicketName("ticket");
But, it didn't make any change. 12:19:35,427 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,427 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,455 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,455 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,471 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,472 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,513 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,514 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,525 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,525 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,566 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: false
12:19:35,566 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating session
12:19:35,653 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: true
12:19:35,653 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating ticket TICKET_3f345f7d803d5446b8319b3d18d72fe9101981cb
It shows, "Alfresco ticket provided: true" and "Authenticating ticket TICKET_3f345f7d803d5446b8319b3d18d72fe9101981cb" in the last line of above log.
16:25:45,514 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Alfresco ticket provided: true
16:25:45,514 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating ticket TICKET_140e281e0d7423399353d111a7620b65d57699c7
16:25:45,514 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Removing the current security information.
16:25:45,514 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting fully authenticated principal: net.sf.acegisecurity.providers.dao.User@33e0c1ff: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
16:25:45,514 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Creating new secure context.
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting RunAs principal: net.sf.acegisecurity.providers.dao.User@68e066f4: Username: System; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_SYSTEM
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting fully authenticated principal: net.sf.acegisecurity.providers.dao.User@33e0c1ff: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting RunAs principal: net.sf.acegisecurity.providers.dao.User@33e0c1ff: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting RunAs principal: net.sf.acegisecurity.providers.dao.User@648752f6: Username: System; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_SYSTEM
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting fully authenticated principal: net.sf.acegisecurity.providers.dao.User@33e0c1ff: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
16:25:45,515 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting RunAs principal: net.sf.acegisecurity.providers.dao.User@33e0c1ff: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
16:25:45,517 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Removing the current security information.
I am not getting any debug logs in share.log file. Logs are coming only in alfresco.log file.06-18-2013 06:02 AM
06-18-2013 08:20 AM
log4j.logger.org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory.WebClientAuthenticator=debug
log4j.logger.org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory=debug
log4j.logger.org.alfresco.repo.web.scripts.servlet.BasicHttpAuthenticatorFactory=debug
log4j.logger.org.alfresco.repo.web.scripts.servlet.BasicHttpAuthenticatorFactory.BasicHttpAuthenticator=debug
log4j.logger.org.alfresco.repo.web.scripts.servlet.AuthenticatorServlet=debug
log4j.logger.org.alfresco.repo.security.authentication.AuthenticationUtil=debug
headers.toString()
{Accept-Language=en-us,en;q=0.5, ticket=TICKET_d8bd7c178ff04530ed2a7bbf09bae5e3ccff3da3, SsoUserHeader=admin, X-Alfresco-Remote-User=admin, alfTicket=TICKET_d8bd7c178ff04530ed2a7bbf09bae5e3ccff3da3, userHeader=SsoUserHeader, user=admin, alf_ticket=TICKET_d8bd7c178ff04530ed2a7bbf09bae5e3ccff3da3}
07-18-2013 01:23 AM
10:43:53,398 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator]
Alfresco ticket provided: false
10:50:18,696 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator]
Alfresco ticket provided: true
10:50:18,696 DEBUG [org.alfresco.repo.web.scripts.servlet.WebClientAuthenticatorFactory$WebClientAuthenticator] Authenticating ticket TICKET_d08252d8da4774ba40ee1b569150222e878a8085
net.sf.acegisecurity.providers.dao.User@1f27c908:
Username: System; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_SYSTEM
10:50:18,704 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting fully authenticated principal: net.sf.acegisecurity.providers.dao.User@66a5ec39:
Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
10:50:18,704 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil] Setting RunAs principal: net.sf.acegisecurity.providers.dao.User@66a5ec39:
Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_AUTHENTICATED
10:50:18,705 DEBUG [org.alfresco.repo.security.authentication.AuthenticationUtil]
Removing the current security information.
@Override
protected void applyRequestHeaders(RemoteClient remoteClient,
ConnectorContext context) {
super.applyRequestHeaders(remoteClient, context);
Map<String, String> headers = new HashMap<String, String>(8);
if (context != null) {
headers.putAll(context.getHeaders());
}
String user = "admin";
headers.put("X-Alfresco-Remote-User", user);
String userHeader = getUserHeader();
if (userHeader != null) {
headers.put(userHeader, user);
}
if (headers.size() != 0) {
remoteClient.setRequestProperties(headers);
}
}
@Override
protected void applyRequestAuthentication(RemoteClient remoteClient, ConnectorContext context)
{
String alfTicket = null;
if (context != null)
{
alfTicket = context.getParameters().get(PARAM_TICKETNAME_ALF_TICKET);
}
if (getConnectorSession() != null)
{
alfTicket = (String)getConnectorSession().getParameter(AlfrescoAuthenticator.CS_PARAM_ALF_TICKET);
}
if (alfTicket != null)
{
remoteClient.setTicket(alfTicket);
remoteClient.setTicketName("ticket");
}
else
{
System.out.println("Guesttt…");
}
}
07-19-2013 06:18 AM
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.