如何通过单点登录将Alfresco与Wordpress集成?

如何通过单点登录将Alfresco与Wordpress集成?,wordpress,single-sign-on,integration,alfresco,alfresco-share,Wordpress,Single Sign On,Integration,Alfresco,Alfresco Share,我试图在Wordpress和Alfresco之间配置一个单一登录,因此我在Wordpress管理面板上添加了Wordpress OAuth2提供程序插件 我创建了一个客户端并将重定向uri插入我的alfresco,插件给了我一个密钥和一个秘密。现在,在登录wordpress后,我进入我的博客,点击链接进入alfresco,但带有url的页面: http://localhost:8080/share/page/repository?oauth=authorize&response_type=cod

我试图在Wordpress和Alfresco之间配置一个单一登录,因此我在Wordpress管理面板上添加了Wordpress OAuth2提供程序插件

我创建了一个客户端并将重定向uri插入我的alfresco,插件给了我一个密钥和一个秘密。现在,在登录wordpress后,我进入我的博客,点击链接进入alfresco,但带有url的页面:

http://localhost:8080/share/page/repository?oauth=authorize&response_type=code&client_id=**************&客户端_secret=***************和重定向_uri=http%3A%2F%2folocalhost%2F%3Fauth%3Dssoe


再次询问我的用户名和密码!如何配置Alfresco,以便使用这些凭据记录它?感谢所有愿意帮助我的人,并为我糟糕的英语感到抱歉。

Alfresco包括多个身份验证系统,包括Alfresco数据库、Active Directory、LDAP、Kerberos、外部,并且可以设置为使用其中一个或它们的组合进行身份验证。通常,这些认证系统涵盖了所需的大多数认证组合和机制

您还可以使用alfresco自定义身份验证子系统, 在这种情况下,当您想要对用户进行身份验证时,需要传递条件, 这是用于身份验证的java类的一些片段

     package org.alfresco.tutorial.repo.security.authentication;

import net.sf.acegisecurity.Authentication;

import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.security.authentication.AbstractAuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.apache.commons.codec.binary.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class CustomAuthenticationComponentImpl extends AbstractAuthenticationComponent {
    private static final Log LOG = LogFactory.getLog(CustomAuthenticationComponentImpl.class);

   /**
    * Some custom properties that could be used to inject a remote login server hostname and port.
    * Not used at the moment but demonstrates property injection in custom authentication component.
    */
    private String remoteAuthenticatorHostname;
    private String remoteAuthenticatorPort;

    public void setRemoteAuthenticatorHostname(String remoteAuthenticatorHostname) {
        this.remoteAuthenticatorHostname = remoteAuthenticatorHostname;
    }

    public void setRemoteAuthenticatorPort(String remoteAuthenticatorPort) {
        this.remoteAuthenticatorPort = remoteAuthenticatorPort;
    }

    public void authenticateImpl(String userName, char[] password) throws AuthenticationException {
        if (LOG.isDebugEnabled()) {
           LOG.debug("Login request(" + remoteAuthenticatorHostname + ":" + remoteAuthenticatorPort +
           ") : [userName=" + userName + "][password=" + String.valueOf(password) + "]");
        }

        // Do your custom authentication here, and then set the current user (in this example we are only allowing
        // john to authenticate successfully, and we don't check pwd)
        // You would typically connect to the remote authentication mechanism to verify username/pwd...
        if (StringUtils.equals(userName, "john") || isGuestUserName(userName) ||
                getDefaultAdministratorUserNames().contains(userName)) {
            setCurrentUser(userName);
        } else {
            String msg = "Login request: username not recognized [userName=" + userName + "]";
            LOG.error(msg);
            throw new AuthenticationException(msg);
        }
    }

    /**
     * The default is not to support token base authentication
     */
    public Authentication authenticate(Authentication token) throws AuthenticationException {
        throw new AlfrescoRuntimeException("Authentication via token not supported");
    }

    /**
     * This authentication component implementation allows guest login
     * @return
     */
    @Override
    protected boolean implementationAllowsGuestLogin() {
        return true;
    }
}

有关更多详细信息,请参阅此

将Alfresco配置为外部身份验证可能更容易,然后在Alfresco前面添加一个代理,该代理可以处理OAuth2令牌。Alfresco本机不支持OAuth2。因此,除非您使用外部身份验证,否则您必须自己编写身份验证代码