首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何通过单点登录将Alfresco与Wordpress集成?

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

Stack Overflow用户
提问于 2018-06-05 17:56:32
回答 2查看 442关注 0票数 0

我正在尝试配置Wordpress和Alfresco之间的单点登录,因此我在WordPress管理面板上添加了wordpress OAuth2 Provider插件。wordpress plugin

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

http://localhost:8080/share/page/repository?oauth=authorize&response_type=code&client_id=**************&client_secret=**************&redirect_uri=http%3A%2F%2Flocalhost%2F%3Fauth%3Dssoe

alfresco login

再问我一次用户名和密码!如何配置Alfresco,使其使用这些凭据进行登录?感谢所有想要帮助我的人,并为我糟糕的英语感到抱歉。

EN

回答 2

Stack Overflow用户

发布于 2018-06-05 19:17:36

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

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

代码语言:javascript
复制
     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;
    }
}

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

票数 1
EN

Stack Overflow用户

发布于 2018-06-10 05:00:22

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50697248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档