`

Cas4集成第三方认证登录

 
阅读更多

1:Cas单点登录原理不做具体介绍了,参考百度推荐文章

2:在开发过程中,客户要求登录使用客户开发的身份统一认证中心,统一身份有cas,oauth2,openid等,这里就简单介绍Cas第三方认证中心,应用调用第三方身份中心,如何获取第三方用户信息,回调返回携带参数等问题,这里以Cas4.2去实现该需求:

下面是一个简单流程:

1):应用发起一个登录请求:

        http://localhost:8043/cas/login?service=http://localhost:8002/sgms?center=cas8043

        center参数:代表不同的第三方认证中心code,通过数据库表去查询,跳转至第三方身份认证中心地址进行登录

2:第三方认证中心登录成功,跳转至我们自己的身份中心,此时返回携带第三方ST,并且可以获取第三方用户名,我们用第三方账户用户名,在我们cas作一个自动登录流程,向浏览器写入cookie,tgt,跳转至最初我们发起请求的应用,注:第三方cas跳转至我们cas携带参数,需二次跳转,否则我们cas自动登录成功,跳转应用地址属于失败状态

        具体表设计:

        DROP TABLE IF EXISTS `cas_third_certification_center`;

        CREATE TABLE `cas_third_certification_center` (

       `id` char(32) NOT NULL,

       `code` varchar(64) DEFAULT NULL,

       `url` varchar(255) DEFAULT NULL COMMENT '第三方认证中心地址',

        `create_id` char(32) DEFAULT NULL,

       `create_time` datetime DEFAULT NULL,

       `update_id` char(32) DEFAULT NULL,

       `update_time` datetime DEFAULT NULL,

        PRIMARY KEY (`id`)

        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

         INSERT INTO `cas_third_certification_center` VALUES ('00072e05bf0e4cdaaf1d7d560e11ad11', 'cas8044', 'http://192.168.1.202:8044/cas', null, null, null, null);

         INSERT INTO `cas_third_certification_center` VALUES ('00072e05bf0e4cdaaf1d7d560efbad11', 'cas8043', 'http://192.168.1.202:8043/cas', null, null, null, null);

    

      cas8044=》http://192.168.1.202:8044/cas

      cas8043=》http://192.168.1.202:8043/cas

      

      查看Cas4.2源码,找到切入点,service检测对应serviceAuthorizationCheck,定义class继承该类,或者重新定义bean,这里我重新定义bean,代码如下

@Component("serviceAuthorizationCheckOver")
public final class ServiceAuthorizationCheckOver extends AbstractAction {

    private JdbcTemplate jdbcTemplate;
    private DataSource dataSource;
@Autowired(required = false)
    public void setDataSource(@Qualifier("queryDatabaseDataSource") final DataSource dataSource) {
        this.jdbcTemplate = new JdbcTemplate(dataSource);
        this.dataSource = dataSource;
}

    protected final JdbcTemplate getJdbcTemplate() {
        return this.jdbcTemplate;
}

    protected final DataSource getDataSource() {
        return this.dataSource;
}

    @NotNull
private final ServicesManager servicesManager;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
     * Initialize the component with an instance of the services manager.
     *
     * @param servicesManager the service registry instance.
     */
@Autowired
public ServiceAuthorizationCheckOver(@Qualifier("servicesManager") final ServicesManager servicesManager) {
        this.servicesManager = servicesManager;
}

    @Override
protected Event doExecute(final RequestContext context) throws Exception {
        HttpServletRequest request = WebUtils.getHttpServletRequest(context);
HttpServletResponse response = WebUtils.getHttpServletResponse(context);
// self cas certificate center
String requestUrl = request.getRequestURL().toString();
String returnUrlKey = Constants.SERVICE_KEY;
String centerCodeKey = Constants.CENTER_CODE_KEY;
        final Service service = WebUtils.getService(context);
context.getFlowScope().put("step", "none");
context.getFlowScope().put("rtnParaStr", "");
        if (service == null) {
            return success();
}

        HttpSession session = request.getSession();
String secondRedirect = (String) session.getAttribute("centerCode");
// get service's parameter of center
Map<String, String> serviceQueryParaMap = UrlCodeUtil.urlSplit(service.getId());
        if (serviceQueryParaMap.containsKey(centerCodeKey) && !StringUtils.isEmpty(serviceQueryParaMap.get(centerCodeKey))
                && StringUtils.isEmpty(secondRedirect)) {

            final String centerCode = serviceQueryParaMap.get(centerCodeKey);
            final String returnUrl = context.getRequestParameters().get(returnUrlKey);
CasThirdCertificationCenterDomain thirdCasDO = this.getCertificateInfo(centerCode);
String encodeUrlString = UrlCodeUtil.encoderString(requestUrl + "?" + returnUrlKey + "=" +
                    returnUrl.substring(0, returnUrl.lastIndexOf('?')));
String url = thirdCasDO.getUrl() + "?" + returnUrlKey + "=" + encodeUrlString;
session.setAttribute("centerCode", centerCode);
session.setAttribute("second", false);
// set redirect url
context.getFlowScope().put("url", url);
context.getFlowScope().put("step", "third");
            return success();
}

        if (this.servicesManager.getAllServices().isEmpty()) {
            final String msg = String.format("No service definitions are found in the service manager. "
+ "Service [%s] will not be automatically authorized to request authentication.", service.getId());
logger.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_EMPTY_SVC_MGMR);
}
        // check current service if null or valid
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
        if (registeredService == null) {
            final String msg = String.format("Service Management: Unauthorized Service Access. "
+ "Service [%s] is not found in service registry.", service.getId());
logger.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
        // service must existed and valid and then second redirect
if (context.getRequestParameters().contains(Constants.CAS_TICKET_KEY)) {
            if (!context.getRequestParameters().contains(returnUrlKey)) {
                final String msg = "Service key not exist.";
logger.warn(msg);
                throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
            String callBackUrl = request.getRequestURL().toString() + "?service=" +
                    context.getRequestParameters().get(returnUrlKey);
String centerCode = (String) session.getAttribute("centerCode");
CasThirdCertificationCenterDomain casDO = this.getCertificateInfo(centerCode);
String ticket = context.getRequestParameters().get(Constants.CAS_TICKET_KEY);
String username = "";
// get user information from third-party
try {
                TicketValidator ticketValidator = new Cas20ServiceTicketValidator(casDO.getUrl());
Assertion casAssertion = ticketValidator.validate(ticket, callBackUrl);
AttributePrincipal casPrincipal = casAssertion.getPrincipal();
username = casPrincipal.getName();
} catch (Exception e) {
                final String msg = String.format("Get username from [%s] failure", casDO.getUrl());
logger.warn(e.getMessage());
                throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
            String url = callBackUrl + "?center" + "=" + session.getAttribute("centerCode");
context.getFlowScope().put("step", "secondRedirect");
session.setAttribute("username", username);
context.getFlowScope().put("secondRedirectUrl", url);
            return success();
}
        // second redirect to local cas center
if (serviceQueryParaMap.containsKey(centerCodeKey) && !StringUtils.isEmpty(serviceQueryParaMap.get(centerCodeKey))
                && !StringUtils.isEmpty(secondRedirect)) {
            String username = (String) session.getAttribute("username");
context.getFlowScope().put("step", "autoSubmit");
context.getFlowScope().put("username", username);
session.invalidate();
            return success();
}
        if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
            final String msg = String.format("Service Management: Unauthorized Service Access. "
+ "Service [%s] is not allowed access via the service registry.", service.getId());
logger.warn(msg);
WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(context,
registeredService.getAccessStrategy().getUnauthorizedRedirectUrl());
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
        return success();
}

    private CasThirdCertificationCenterDomain getCertificateInfo(String centerCode) throws GeneralSecurityException {
        String searchSqlQuery = "select * from cas_third_certification_center where code = '" + centerCode +
                "' LIMIT 1";
        if (getJdbcTemplate() == null) {
            throw new GeneralSecurityException("Authentication handler is not configured correctly");
}
        CasThirdCertificationCenterDomain thirdCasDO = getJdbcTemplate().queryForObject(searchSqlQuery,
                new CasThirdCertificationCenterRowMapper());
        if (thirdCasDO == null) {
            final String msg = String.format("Third certificate code not correct, can not find third integrated " +
                    "certificate center,the code is [%s].", centerCode);
logger.warn(msg);
            throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
        return thirdCasDO;
}
}

login.workflow代码

<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/webflow"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
                          http://www.springframework.org/schema/webflow/spring-webflow.xsd">
<!-- 用来存储用户名和密码信息 -->
<var name="credential" class="org.jasig.cas.authentication.UsernamePasswordCredential"/>
    <on-start>
        <evaluate expression="initialFlowSetupAction"/>
    </on-start>
    <action-state id="ticketGrantingTicketCheck">
        <evaluate expression="ticketGrantingTicketCheckAction"/>
        <transition on="notExists" to="gatewayRequestCheck"/>
        <transition on="invalid" to="terminateSession"/>
        <transition on="valid" to="hasServiceCheck"/>
    </action-state>
    <action-state id="terminateSession">
        <evaluate expression="terminateSessionAction.terminate(flowRequestContext)"/>
        <transition to="gatewayRequestCheck"/>
    </action-state>
    <decision-state id="gatewayRequestCheck">
        <if test="requestParameters.gateway != '' and requestParameters.gateway != null and flowScope.service != null"
then="gatewayServicesManagementCheck" else="serviceAuthorizationCheck"/>
    </decision-state>
    <decision-state id="hasServiceCheck">
        <if test="flowScope.service != null" then="renewRequestCheck" else="viewGenericLoginSuccess"/>
    </decision-state>
    <decision-state id="renewRequestCheck">
        <if test="requestParameters.renew != '' and requestParameters.renew != null" then="serviceAuthorizationCheck"
else="generateServiceTicket"/>
    </decision-state>
<!-- Do a service authorization check early without the need to login first -->
<action-state id="serviceAuthorizationCheck">
        <evaluate expression="serviceAuthorizationCheckOver"/>
        <transition to="ssoCheck"/>
    </action-state>
    <decision-state id="ssoCheck">
        <if test="flowScope.step == 'none'" then="initializeLogin"/>
        <if test="flowScope.step == 'autoSubmit'" then="autoLogin"/>
        <if test="flowScope.step == 'third'" then="redirectThirdSSO"/>
        <if test="flowScope.step == 'secondRedirect'" then="secondRedirect"/>
    </decision-state>
    <end-state id="redirectThirdSSO" view="externalRedirect:#{flowScope.url}"></end-state>
    <end-state id="secondRedirect" view="externalRedirect:#{flowScope.secondRedirectUrl}"></end-state>
    <action-state id="autoLogin">
        <evaluate expression="'success'"/>
        <transition on="success" to="autoLoginNoSubmit"/>
        <transition on="successWithWarnings" to="showMessages"/>
        <transition on="authenticationFailure" to="handleAuthenticationFailure"/>
        <transition on="error" to="initializeLogin"/>
    </action-state>
    <action-state id="autoLoginNoSubmit">
        <evaluate
expression="authenticationViaFormActionOver.autoLoginNoSubmit(flowRequestContext, messageContext,
                flowScope.username)"/>
        <transition on="success" to="sendTicketGrantingTicket"/>
    </action-state>
<!--
        The "warn" action makes the determination of whether to redirect directly to the requested
        service or display the "confirmation" page to go back to the server.
    -->
<decision-state id="warn">
        <if test="flowScope.warnCookieValue" then="showWarningView" else="redirect"/>
    </decision-state>
    <action-state id="initializeLogin">
        <evaluate expression="'success'"/>
        <transition on="success" to="viewLoginForm"/>
    </action-state>
    <view-state id="viewLoginForm" view="casLoginView" model="credential">
        <binder>
            <binding property="username" required="true"/>
            <binding property="password" required="true"/>
<!--
            <binding property="rememberMe" />
            -->
</binder>
        <on-entry>
            <set name="viewScope.commandName" value="'credential'"/>
<!--
            <evaluate expression="samlMetadataUIParserAction" />
            -->
</on-entry>
        <transition on="submit" bind="true" validate="true" to="realSubmit"/>
    </view-state>
    <action-state id="realSubmit">
        <evaluate
expression="authenticationViaFormAction.submit(flowRequestContext, flowScope.credential, messageContext)"/>
        <transition on="warn" to="warn"/>
<!--
        To enable AUP workflows, replace the 'success' transition with the following:
        <transition on="success" to="acceptableUsagePolicyCheck" />
        -->
<transition on="success" to="loginSuccess"/>
        <transition on="successWithWarnings" to="showMessages"/>
        <transition on="authenticationFailure" to="handleAuthenticationFailure"/>
        <transition on="error" to="initializeLogin"/>
    </action-state>
    <action-state id="loginSuccess">
        <evaluate expression="loginSuccessAction"/>
        <transition on="success" to="sendTicketGrantingTicket"/>
    </action-state>
    <view-state id="showMessages" view="casLoginMessageView">
        <on-entry>
            <evaluate expression="sendTicketGrantingTicketAction"/>
            <set name="requestScope.messages" value="messageContext.allMessages"/>
        </on-entry>
        <transition on="proceed" to="serviceCheck"/>
    </view-state>
    <action-state id="handleAuthenticationFailure">
        <evaluate expression="authenticationExceptionHandler.handle(currentEvent.attributes.error, messageContext)"/>
        <transition on="AccountDisabledException" to="casAccountDisabledView"/>
        <transition on="AccountLockedException" to="casAccountLockedView"/>
        <transition on="AccountPasswordMustChangeException" to="casMustChangePassView"/>
        <transition on="CredentialExpiredException" to="casExpiredPassView"/>
        <transition on="InvalidLoginLocationException" to="casBadWorkstationView"/>
        <transition on="InvalidLoginTimeException" to="casBadHoursView"/>
        <transition on="FailedLoginException" to="errorCount"/>
        <transition on="AccountNotFoundException" to="initializeLogin"/>
        <transition on="UNKNOWN" to="initializeLogin"/>
    </action-state>
    <action-state id="errorCount">
        <evaluate expression="repeatLoginErrorCountAction"/>
        <transition on="success" to="initializeLogin"/>
    </action-state>
    <action-state id="sendTicketGrantingTicket">
        <evaluate expression="sendTicketGrantingTicketAction"/>
        <transition to="serviceCheck"/>
    </action-state>
    <decision-state id="serviceCheck">
        <if test="flowScope.service != null" then="generateServiceTicket" else="viewGenericLoginSuccess"/>
    </decision-state>
    <action-state id="generateServiceTicket">
        <evaluate expression="generateServiceTicketAction"/>
        <transition on="success" to="warn"/>
        <transition on="authenticationFailure" to="handleAuthenticationFailure"/>
        <transition on="error" to="initializeLogin"/>
        <transition on="gateway" to="gatewayServicesManagementCheck"/>
    </action-state>
    <action-state id="gatewayServicesManagementCheck">
        <evaluate expression="gatewayServicesManagementCheck"/>
        <transition on="success" to="redirect"/>
    </action-state>
    <action-state id="redirect">
        <evaluate expression="flowScope.service.getResponse(requestScope.serviceTicketId)"
result-type="org.jasig.cas.authentication.principal.Response" result="requestScope.response"/>
        <transition to="postRedirectDecision"/>
    </action-state>
    <decision-state id="postRedirectDecision">
        <if test="requestScope.response.responseType.name() == 'POST'" then="postView" else="redirectView"/>
    </decision-state>
<!--
        the "viewGenericLoginSuccess" is the end state for when a user attempts to login without coming directly from a service.
        They have only initialized their single-sign on session.
    -->
    <!--    <end-state id="viewGenericLoginSuccess" view="externalRedirect:#{flowScope.credential.sys_url}" />-->
<end-state id="viewGenericLoginSuccess" view="casGenericSuccessView">
        <on-entry>
            <evaluate expression="genericSuccessViewAction.getAuthenticationPrincipal(flowScope.ticketGrantingTicketId)"
result="requestScope.principal"
result-type="org.jasig.cas.authentication.principal.Principal"/>
        </on-entry>
    </end-state>
<!--
    The "showWarningView" end state is the end state for when the user has requested privacy settings (to be "warned")
    to be turned on.  It delegates to a view defines in default_views.properties that display the
    "Please click here to go to the service." message.
    -->
<end-state id="showWarningView" view="casConfirmView"/>
<!-- Password policy failure states -->
<end-state id="abstactPasswordChangeView">
        <on-entry>
            <set name="flowScope.passwordPolicyUrl" value="passwordPolicyConfiguration.passwordPolicyUrl"/>
        </on-entry>
    </end-state>
    <end-state id="casExpiredPassView" view="casExpiredPassView" parent="#abstactPasswordChangeView"/>
    <end-state id="casMustChangePassView" view="casMustChangePassView" parent="#abstactPasswordChangeView"/>
    <end-state id="casAccountDisabledView" view="casAccountDisabledView"/>
    <end-state id="casAccountLockedView" view="casAccountLockedView"/>
    <end-state id="casBadHoursView" view="casBadHoursView"/>
    <end-state id="casBadWorkstationView" view="casBadWorkstationView"/>
    <end-state id="postView" view="postResponseView">
        <on-entry>
            <set name="requestScope.parameters" value="requestScope.response.attributes"/>
            <set name="requestScope.originalUrl" value="flowScope.service.id"/>
        </on-entry>
    </end-state>
<!--
        The "redirect" end state allows CAS to properly end the workflow while still redirecting
        the user back to the service required.
    -->
<end-state id="redirectView" view="externalRedirect:#{requestScope.response.url}#{flowScope.rtnParaStr}"/>
    <end-state id="viewServiceErrorView" view="serviceErrorView"/>
    <decision-state id="serviceUnauthorizedCheck">
        <if test="flowScope.unauthorizedRedirectUrl != null"
then="viewRedirectToUnauthorizedUrlView"
else="viewServiceErrorView"/>
    </decision-state>
    <end-state id="viewRedirectToUnauthorizedUrlView" view="externalRedirect:#{flowScope.unauthorizedRedirectUrl}"/>
    <end-state id="viewServiceSsoErrorView" view="serviceErrorSsoView"/>
    <global-transitions>
        <transition to="viewLoginForm" on-exception="org.jasig.cas.services.UnauthorizedSsoServiceException"/>
        <transition to="viewServiceErrorView"
on-exception="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException"/>
        <transition to="serviceUnauthorizedCheck" on-exception="org.jasig.cas.services.UnauthorizedServiceException"/>
        <transition to="serviceUnauthorizedCheck"
on-exception="org.jasig.cas.services.UnauthorizedServiceForPrincipalException"/>
    </global-transitions>
</flow>

  

 自动登录,绕过数据库验证,生成tgt,重新定义bean,authenticationViaFormAction

 @Component("authenticationViaFormActionOver")

public class AuthenticationViaFormActionOver {
    /**
     * Authentication succeeded with warnings from authn subsystem that should be displayed to user.
     */
public static final String SUCCESS_WITH_WARNINGS = "successWithWarnings";
/**
     * Authentication failure result.
     */
public static final String AUTHENTICATION_FAILURE = "authenticationFailure";
/**
     * Flow scope attribute that determines if authn is happening at a public workstation.
     */
public static final String PUBLIC_WORKSTATION_ATTRIBUTE = "publicWorkstation";
/**
     * Logger instance.
     **/
protected final transient Logger logger = LoggerFactory.getLogger(getClass());
/**
     * Core we delegate to for handling all ticket related tasks.
     */
@NotNull
    @Autowired
    @Qualifier("centralAuthenticationService")
    private CentralAuthenticationService centralAuthenticationService;
@NotNull
    @Autowired
    @Qualifier("warnCookieGenerator")
    private CookieGenerator warnCookieGenerator;
@NotNull
    @Autowired(required = false)
    @Qualifier("defaultAuthenticationSystemSupport")
    private AuthenticationSystemSupport authenticationSystemSupport = new DefaultAuthenticationSystemSupport();
    public final Event autoLoginNoSubmit(final RequestContext context, final MessageContext messageContext,
                                         final String username) {
        Credential credential = new UsernamePasswordCredential(username, Constants.RANDOM_THIRD_PASSWORD);
        return createTicketGrantingTicket(context, credential, messageContext);
}

    /**
     * Is request asking for service ticket?
     *
     * @param context the context
     * @return true, if both service and tgt are found, and the request is not asking to renew.
     * @since 4.1.0
     */
protected boolean isRequestAskingForServiceTicket(final RequestContext context) {
        final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
        final Service service = WebUtils.getService(context);
        return (StringUtils.isNotBlank(context.getRequestParameters().get(CasProtocolConstants.PARAMETER_RENEW))
                && ticketGrantingTicketId != null
&& service != null);
}

/**
     * Create ticket granting ticket for the given credentials.
     * Adds all warnings into the message context.
     *
     * @param context        the context
     * @param credential     the credential
     * @param messageContext the message context
     * @return the resulting event.
     * @since 4.1.0
     */
protected Event createTicketGrantingTicket(final RequestContext context, final Credential credential,
                                               final MessageContext messageContext) {
        try {
            // 获取service
final Service service = WebUtils.getService(context);
            final AuthenticationContextBuilder builder = new DefaultAuthenticationContextBuilder(
                    this.authenticationSystemSupport.getPrincipalElectionStrategy());
//form表单提交信息封装认证信息
final AuthenticationTransaction transaction = AuthenticationTransaction.wrap(credential);
//进行登录的用户登录名和密码的校验
this.authenticationSystemSupport.getAuthenticationTransactionManager().handle(transaction, builder);
//通过认证信息和service形成认证结果集
final AuthenticationContext authenticationContext = builder.build(service);
//认证成功后进行TGT的创建工作
final TicketGrantingTicket tgt = this.centralAuthenticationService.createTicketGrantingTicket(authenticationContext);
WebUtils.putTicketGrantingTicketInScopes(context, tgt);
WebUtils.putWarnCookieIfRequestParameterPresent(this.warnCookieGenerator, context);
putPublicWorkstationToFlowIfRequestParameterPresent(context);
//如果只是进行服务端代码分析,此处不进行警告
if (addWarningMessagesToMessageContextIfNeeded(tgt, messageContext)) {
                return newEvent(SUCCESS_WITH_WARNINGS);
}
            return newEvent("success");
} catch (final AuthenticationException e) {
            logger.debug(e.getMessage(), e);
            return newEvent(AUTHENTICATION_FAILURE, e);
} catch (final Exception e) {
            logger.debug(e.getMessage(), e);
            return newEvent("error", e);
}
    }

 未完待续,需重新整理

分享到:
评论

相关推荐

    cas、第三方接口登录

    总结来说,CAS单点登录是一种有效的用户认证解决方案,而QQ和微博的第三方登录接口则为企业和网站提供了便捷的社会化登录方式。正确集成这些接口,能够提升用户满意度,同时简化登录流程,降低用户流失率。开发者...

    cas3.5.0集成oauth2.0协议

    4. **获取访问令牌**:用户授权后,CAS服务器会返回一个访问令牌给客户端,客户端可以使用该令牌向第三方服务请求资源。 5. **资源访问**:持有访问令牌的客户端可以向第三方服务发送请求,第三方服务验证令牌有效...

    第三方登录

    4. **编写代码逻辑**:使用SDK提供的API发起登录请求,通常这会引导用户跳转到第三方应用进行授权。授权成功后,第三方应用会回调到你的应用,并提供一个访问令牌。你需要使用这个令牌来获取用户的个人信息,如...

    Spring Security OAuth2集成短信验证码登录以及第三方登录

    接入这个流程之后,基本上就可以优雅集成第三方登录。 实现集成登录认证组件的思路可以分为以下步骤: 1. 定义拦截器拦截登录的请求 2. 在拦截的通知进行预处理 3. 在UserDetailService.loadUserByUsername方法中...

    Liferay集成CAS实现单点登录与应用系统集成

    6. **第三方组件**:整合Velocity、Hibernate、Lucene、Struts等开源项目。 7. **多语言支持**:包括中文在内的多种语言界面。 8. **个性化定制**:用户可自定义页面布局和风格。 **CAS系统介绍** CAS(Central ...

    CAS4.1.4服务端和客户端实例

    4. 配置客户端应用,将CAS认证集成到你的应用中,这通常涉及添加和配置CAS过滤器,以及设置服务URL。 5. 测试SSO功能,确保用户能够通过CAS服务器进行一次性登录,并在不同应用间无缝切换。 通过这个实例,你可以...

    cas源码修改-登录页面

    9. **API扩展**:如果需要在登录页面添加自定义功能,如集成第三方服务,可以通过实现 CAS 提供的 REST API 或者 WebService API 来实现。 10. **文档更新**:任何代码更改后,确保更新相关的开发者文档,以便团队...

    第三方系统单点登录到EAS的二次开发指南.rar

    4. 集成SSO服务:在第三方系统中调用EAS提供的SSO接口,实现登录验证逻辑。 5. 跳转逻辑处理:在用户访问第三方系统时,如果未登录则跳转到EAS的登录页面,登录成功后返回第三方系统。 6. 会话管理:管理和维护用户...

    SANGFOR_SSL_v7.6.8_CONF_CAS账号认证配置指导.pdf

    **3.1 对接第三方认证服务器** 1. 在SSL设备的控制台,进入【SSL VPN设置】-【认证设置】-【主要认证】-【第三方认证】,点击设置按钮。 2. 新建CAS账号认证,填写配置参数,包括认证名称(如“CAS账号认证”)、...

    CAS单点登录服务器端源码

    6. **cas-server-support-oauth**:支持OAuth协议,允许第三方应用安全地访问受CAS保护的服务。 7. **cas-server-support-saml**:支持SAML协议,可以与其他SAML兼容的身份提供商进行交互。 8. **cas-server-...

    SSO之CAS单点登录实例演示

    5. **自定义认证**:CAS支持自定义认证机制,例如,可以对接LDAP、数据库或其他第三方认证服务,以适应不同组织的需求。 6. **单点登出**:CAS还提供了单点登出功能,当用户在一个应用中登出时,所有其他已登录的...

    cas整合到jeesite2自定义用户登录信息所需包

    3. **第三方库支持**:`mchange-commons-java-0.2.3.4.jar`和`c3p0-0.9.2.1.jar`是数据库连接池的组件。Mchange Commons提供了一些通用的数据库工具,而C3P0是一个开源的JDBC连接池,可以提高数据库操作的性能和稳定...

    CAS单点登录(SSO)教程

    在实际生产环境中,通常会从第三方机构如VeriSign获取数字证书。但在学习或测试环境中,可以使用JDK自带的`keytool`工具来自行创建证书。具体步骤如下: - 创建证书文件夹 `d:/keys` - 执行命令 `keytool -genkey -...

    Laravel开发-cas

    在Laravel 4.x版本中,可以通过第三方库如`jasig/laravel-cas`来实现CAS的集成。这个库提供了一个中间件,可以拦截请求,检查CAS票证,并根据票证处理用户身份验证。 **3. 安装与配置** 首先,你需要通过Composer...

    cas单点登录客户端--c++版

    C++标准库提供了`std::urlencode`函数,或者可以使用第三方库如cpprestsdk。 5. **证书与安全**:CAS服务通常使用HTTPS,因此客户端需要处理SSL/TLS证书。C++标准库提供了一些基础支持,但可能需要配合OpenSSL库来...

    WAS与CAS配置

    在本案例中,使用TAI可以实现对第三方认证的信任,即CAS的认证信息。配置TAI需要在WAS中设置拦截器,它会在用户请求访问WAS应用时,重定向到CAS进行认证,认证通过后,CAS服务器会将用户重定向回WAS并附带一个服务...

    Laravel开发-phpcas

    Laravel提供了服务提供者和服务容器的概念,方便我们集成第三方库。你需要创建一个自定义的服务提供者,将`phpCAS`注册到Laravel的容器中。在`app/Providers`目录下创建一个新的服务提供者,例如`CasServiceProvider...

    cas-client3.2.1

    1. **下载和导入JAR包**:首先,你需要从官方源或者第三方仓库下载`cas-client3.2.1`压缩包,并从中提取`cas-client-core-3.2.1.jar`到你的项目库中。 2. **配置应用**:在应用的`pom.xml`(如果你使用的是Maven)...

    cas的部署规则

    - 由于未购买第三方证书,本例采用keytool工具生成自签名证书。 - 进入Tomcat所在目录,在命令行中执行以下命令: - 生成服务端密钥文件:`keytool -genkey -alias casserver -keypass 198851 -keyalg RSA -...

    cas-server4.0

    - 社区活跃,有丰富的第三方插件和工具可供选择,满足不同场景的需求。 9. **文档与社区支持**: - 官方提供详尽的文档和API参考,帮助开发者理解和使用CAS服务器4.0。 - 开源社区活跃,开发者可以在论坛、邮件...

Global site tag (gtag.js) - Google Analytics