• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PreventedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apereo.cas.authentication.PreventedException的典型用法代码示例。如果您正苦于以下问题:Java PreventedException类的具体用法?Java PreventedException怎么用?Java PreventedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PreventedException类属于org.apereo.cas.authentication包,在下文中一共展示了PreventedException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    try {
        final RadiusTokenCredential radiusCredential = (RadiusTokenCredential) credential;
        final String password = radiusCredential.getToken();

        final RequestContext context = RequestContextHolder.getRequestContext();
        final String username = WebUtils.getAuthentication(context).getPrincipal().getId();

        final Pair<Boolean, Optional<Map<String, Object>>> result =
                RadiusUtils.authenticate(username, password, this.servers,
                        this.failoverOnAuthenticationFailure, this.failoverOnException);
        if (result.getKey()) {
            return createHandlerResult(credential,
                    this.principalFactory.createPrincipal(username, result.getValue().get()),
                    new ArrayList<>());
        }
        throw new FailedLoginException("Radius authentication failed for user " + username);
    } catch (final Exception e) {
        throw new FailedLoginException("Radius authentication failed " + e.getMessage());
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:23,代码来源:RadiusTokenAuthenticationHandler.java


示例2: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    try {
        final AzureAuthenticatorTokenCredential c = (AzureAuthenticatorTokenCredential) credential;
        final RequestContext context = RequestContextHolder.getRequestContext();
        final Principal principal = WebUtils.getAuthentication(context).getPrincipal();

        LOGGER.debug("Received principal id [{}]", principal.getId());
        final PFAuthParams params = authenticationRequestBuilder.build(principal, c);
        final PFAuthResult r = azureAuthenticatorInstance.authenticate(params);

        if (r.getAuthenticated()) {
            return createHandlerResult(c, principalFactory.createPrincipal(principal.getId()), null);
        }
        LOGGER.error("Authentication failed. Call status: [{}]-[{}]. Error: [{}]", r.getCallStatus(),
                r.getCallStatusString(), r.getMessageError());

    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    throw new FailedLoginException("Failed to authenticate user");
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:23,代码来源:AzureAuthenticatorAuthenticationHandler.java


示例3: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential transformedCredential, 
                                                             final String originalPassword)
        throws GeneralSecurityException, PreventedException {
    try {
        if (this.fileName == null) {
            throw new FileNotFoundException("Filename does not exist");
        }
        final String username = transformedCredential.getUsername();
        final String passwordOnRecord = getPasswordOnRecord(username);
        if (StringUtils.isBlank(passwordOnRecord)) {
            throw new AccountNotFoundException(username + " not found in backing file.");
        }
        if (matches(originalPassword, passwordOnRecord)) {
            return createHandlerResult(transformedCredential, this.principalFactory.createPrincipal(username), null);
        }
    } catch (final IOException e) {
        throw new PreventedException("IO error reading backing file", e);
    }
    throw new FailedLoginException();
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:22,代码来源:FileAuthenticationHandler.java


示例4: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential, final String originalPassword)
        throws GeneralSecurityException, PreventedException {

    try {
        final String username = credential.getUsername();
        final Pair<Boolean, Optional<Map<String, Object>>> result =
                RadiusUtils.authenticate(username, credential.getPassword(), this.servers,
                        this.failoverOnAuthenticationFailure, this.failoverOnException);
        if (result.getKey()) {
            return createHandlerResult(credential,
                    this.principalFactory.createPrincipal(username, result.getValue().get()),
                    new ArrayList<>());
        }
        throw new FailedLoginException("Radius authentication failed for user " + username);
    } catch (final Exception e) {
        throw new FailedLoginException("Radius authentication failed " + e.getMessage());
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:20,代码来源:RadiusAuthenticationHandler.java


示例5: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential c, final String originalPassword)
        throws GeneralSecurityException, PreventedException {

    try {
        final UsernamePasswordCredential creds = new UsernamePasswordCredential(c.getUsername(), c.getPassword());
        
        final ResponseEntity<SimplePrincipal> authenticationResponse = api.authenticate(creds);
        if (authenticationResponse.getStatusCode() == HttpStatus.OK) {
            final SimplePrincipal principalFromRest = authenticationResponse.getBody();
            if (principalFromRest == null || StringUtils.isBlank(principalFromRest.getId())) {
                throw new FailedLoginException("Could not determine authentication response from rest endpoint for " + c.getUsername());
            }
            return createHandlerResult(c,
                    this.principalFactory.createPrincipal(principalFromRest.getId(), principalFromRest.getAttributes()),
                    new ArrayList<>());
        }
    } catch (final HttpClientErrorException e) {
        if (e.getStatusCode() == HttpStatus.FORBIDDEN) {
            throw new AccountDisabledException("Could not authenticate forbidden account for " + c.getUsername());
        }
        if (e.getStatusCode() == HttpStatus.UNAUTHORIZED) {
            throw new FailedLoginException("Could not authenticate account for " + c.getUsername());
        }
        if (e.getStatusCode() == HttpStatus.NOT_FOUND) {
            throw new AccountNotFoundException("Could not locate account for " + c.getUsername());
        }
        if (e.getStatusCode() == HttpStatus.LOCKED) {
            throw new AccountLockedException("Could not authenticate locked account for " + c.getUsername());
        }
        if (e.getStatusCode() == HttpStatus.PRECONDITION_REQUIRED) {
            throw new AccountExpiredException("Could not authenticate expired account for " + c.getUsername());
        }

        throw new FailedLoginException("Rest endpoint returned an unknown status code "
                + e.getStatusCode() + " for " + c.getUsername());
    }
    throw new FailedLoginException("Rest endpoint returned an unknown response for " + c.getUsername());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:40,代码来源:RestAuthenticationHandler.java


示例6: createResult

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
/**
 * Build the handler result.
 *
 * @param credentials the provided credentials
 * @param profile     the retrieved user profile
 * @return the built handler result
 * @throws GeneralSecurityException On authentication failure.
 * @throws PreventedException       On the indeterminate case when authentication is prevented.
 */
protected HandlerResult createResult(final ClientCredential credentials, final UserProfile profile)
        throws GeneralSecurityException, PreventedException {

    if (profile != null) {
        final String id;
        if (isTypedIdUsed) {
            id = profile.getTypedId();
        } else {
            id = profile.getId();
        }
        if (StringUtils.isNotBlank(id)) {
            credentials.setUserProfile(profile);
            credentials.setTypedIdUsed(isTypedIdUsed);
            return new DefaultHandlerResult(
                    this,
                    new BasicCredentialMetaData(credentials),
                    this.principalFactory.createPrincipal(id, profile.getAttributes()));
        }

        throw new FailedLoginException("No identifier found for this user profile: " + profile);
    }

    throw new FailedLoginException("Authentication did not produce a user profile for: " + credentials);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:34,代码来源:AbstractPac4jAuthenticationHandler.java


示例7: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    final AuthyTokenCredential tokenCredential = (AuthyTokenCredential) credential;
    final RequestContext context = RequestContextHolder.getRequestContext();
    final Principal principal = WebUtils.getAuthentication(context).getPrincipal();

    final User user = instance.getOrCreateUser(principal);
    if (!user.isOk()) {
        throw new FailedLoginException(AuthyClientInstance.getErrorMessage(user.getError()));
    }

    final Map<String, String> options = new HashMap<>(1);
    options.put("force", this.forceVerification.toString());

    final Token verification = this.instance.getAuthyTokens().verify(user.getId(), tokenCredential.getToken(), options);

    if (!verification.isOk()) {
        throw new FailedLoginException(AuthyClientInstance.getErrorMessage(verification.getError()));
    }

    return createHandlerResult(tokenCredential, principal, new ArrayList<>());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:23,代码来源:AuthyAuthenticationHandler.java


示例8: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential, final String originalPassword)
        throws GeneralSecurityException, PreventedException {

    if (this.kerberosKdcSystemProperty != null) {
        LOGGER.debug("Configured kerberos system property [{}] to [{}]", SYS_PROP_KERB5_KDC, this.kerberosKdcSystemProperty);
        System.setProperty(SYS_PROP_KERB5_KDC, this.kerberosKdcSystemProperty);
    }
    if (this.kerberosRealmSystemProperty != null) {
        LOGGER.debug("Setting kerberos system property [{}] to [{}]", SYS_PROP_KRB5_REALM, this.kerberosRealmSystemProperty);
        System.setProperty(SYS_PROP_KRB5_REALM, this.kerberosRealmSystemProperty);
    }

    final String username = credential.getUsername();
    final String password = credential.getPassword();

    final LoginContext lc = new LoginContext(this.realm, new UsernamePasswordCallbackHandler(username, password));
    try {
        LOGGER.debug("Attempting authentication for: [{}]", username);
        lc.login();
    } finally {
        lc.logout();
    }

    Principal principal = null;
    final Set<java.security.Principal> principals = lc.getSubject().getPrincipals();
    if (principals != null && !principals.isEmpty()) {
        final java.security.Principal secPrincipal = principals.iterator().next();
        principal = this.principalFactory.createPrincipal(secPrincipal.getName());
    }
    return createHandlerResult(credential, principal, null);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:33,代码来源:JaasAuthenticationHandler.java


示例9: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(Credential credential) throws GeneralSecurityException, PreventedException {
    final Map<String, Object> map = new LinkedHashMap<>();
    if (credential instanceof TaraCredential) {
        TaraCredential taraCredential = (TaraCredential) credential;
        this.putIfNotEmpty(map, "principalCode", taraCredential.getPrincipalCode());
        this.putIfNotEmpty(map, "firstName", taraCredential.getFirstName());
        this.putIfNotEmpty(map, "lastName", taraCredential.getLastName());
        if (AuthenticationType.MobileID.equals(taraCredential.getType())) {
            this.putIfNotEmpty(map, "mobileNumber", taraCredential.getMobileNumber());
        }
        return this.createHandlerResult(credential, this.principalFactory
            .createPrincipal(taraCredential.getId(), map), new ArrayList<>());
    }
    return null;
}
 
开发者ID:e-gov,项目名称:TARA-Server,代码行数:17,代码来源:TaraAuthenticationHandler.java


示例10: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    final GoogleAuthenticatorTokenCredential tokenCredential = (GoogleAuthenticatorTokenCredential) credential;

    if (!NumberUtils.isCreatable(tokenCredential.getToken())) {
        throw new PreventedException("Invalid non-numeric OTP format specified.",
                new IllegalArgumentException("Invalid token " + tokenCredential.getToken()));
    }
    final int otp = Integer.parseInt(tokenCredential.getToken());
    LOGGER.debug("Received OTP [{}]", otp);

    final RequestContext context = RequestContextHolder.getRequestContext();
    if (context == null) {
        new IllegalArgumentException("No request context could be found to locate an authentication event");
    }
    final Authentication authentication = WebUtils.getAuthentication(context);
    if (authentication == null) {
        new IllegalArgumentException("Request context has no reference to an authentication event to locate a principal");
    }
    final String uid = authentication.getPrincipal().getId();

    LOGGER.debug("Received principal id [{}]", uid);
    final String secKey = this.credentialRepository.getSecret(uid);
    if (StringUtils.isBlank(secKey)) {
        throw new AccountNotFoundException(uid + " cannot be found in the registry");
    }

    if (this.tokenRepository.exists(uid, otp)) {
        throw new AccountExpiredException(uid + " cannot reuse OTP " + otp + " as it may be expired/invalid");
    }

    final boolean isCodeValid = this.googleAuthenticatorInstance.authorize(secKey, otp);
    if (isCodeValid) {
        this.tokenRepository.store(new GoogleAuthenticatorToken(otp, uid));
        return createHandlerResult(tokenCredential, this.principalFactory.createPrincipal(uid), null);
    }
    throw new FailedLoginException("Failed to authenticate code " + otp);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:39,代码来源:GoogleAuthenticatorAuthenticationHandler.java


示例11: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    final YubiKeyCredential yubiKeyCredential = (YubiKeyCredential) credential;

    final String otp = yubiKeyCredential.getToken();

    if (!YubicoClient.isValidOTPFormat(otp)) {
        LOGGER.debug("Invalid OTP format [{}]", otp);
        throw new AccountNotFoundException("OTP format is invalid");
    }

    final RequestContext context = RequestContextHolder.getRequestContext();
    final String uid = WebUtils.getAuthentication(context).getPrincipal().getId();
    final String publicId = YubicoClient.getPublicId(otp);
    if (this.registry != null
            && !this.registry.isYubiKeyRegisteredFor(uid, publicId)) {
        LOGGER.debug("YubiKey public id [{}] is not registered for user [{}]", publicId, uid);
        throw new AccountNotFoundException("YubiKey id is not recognized in registry");
    }

    try {
        final VerificationResponse response = this.client.verify(otp);
        final ResponseStatus status = response.getStatus();
        if (status.compareTo(ResponseStatus.OK) == 0) {
            LOGGER.debug("YubiKey response status [{}] at [{}]", status, response.getTimestamp());
            return createHandlerResult(yubiKeyCredential, this.principalFactory.createPrincipal(uid), null);
        }
        throw new FailedLoginException("Authentication failed with status: " + status);
    } catch (final YubicoVerificationException | YubicoValidationFailure e) {
        LOGGER.error(e.getMessage(), e);
        throw new FailedLoginException("YubiKey validation failed: " + e.getMessage());
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:34,代码来源:YubiKeyAuthenticationHandler.java


示例12: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential, final String originalPassword)
        throws GeneralSecurityException, PreventedException {

    final String username = credential.getUsername();
    if (this.users.contains(username)) {
        throw new FailedLoginException();
    }

    return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:12,代码来源:RejectUsersAuthenticationHandler.java


示例13: verifyAuthenticateNoFileName

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Test
public void verifyAuthenticateNoFileName() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    this.authenticationHandler = new FileAuthenticationHandler("", null, null, new ClassPathResource("fff"), FileAuthenticationHandler.DEFAULT_SEPARATOR);

    c.setUsername("scott");
    c.setPassword("rutgers");

    this.thrown.expect(PreventedException.class);
    this.thrown.expectMessage("IO error reading backing file");

    this.authenticationHandler.authenticate(c);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:14,代码来源:FileAuthenticationHandlerTests.java


示例14: authenticateUsernamePasswordInternal

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential credential, final String originalPassword)
        throws GeneralSecurityException, PreventedException {

    String sql = null;
    if (StringUtils.isNotBlank(tableUsers) || StringUtils.isNotBlank(fieldUser) || StringUtils.isNotBlank(fieldPassword)) {
        sql = "SELECT COUNT('x') FROM ".concat(this.tableUsers).concat(" WHERE ").concat(this.fieldUser)
                .concat(" = ? AND ").concat(this.fieldPassword).concat("= ?");
    }

    if (StringUtils.isBlank(sql) || getJdbcTemplate() == null) {
        throw new GeneralSecurityException("Authentication handler is not configured correctly. "
                + "No SQL statement or JDBC template found");
    }

    final String username = credential.getUsername();
    try {
        LOGGER.debug("Executing SQL query [{}]", sql);

        final int count = getJdbcTemplate().queryForObject(sql, Integer.class, username, credential.getPassword());
        if (count == 0) {
            throw new FailedLoginException(username + " not found with SQL query.");
        }
        return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
    } catch (final DataAccessException e) {
        throw new PreventedException("SQL exception while executing query for " + username, e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:29,代码来源:SearchModeSearchDatabaseAuthenticationHandler.java


示例15: verifyBadQuery

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Test
public void verifyBadQuery() throws Exception {
    final QueryDatabaseAuthenticationHandler q = new QueryDatabaseAuthenticationHandler("", null, null, null, this.dataSource, SQL.replace("*", "error"),
            PASSWORD_FIELD, null, null, Collections.emptyMap());
    this.thrown.expect(PreventedException.class);
    q.authenticate(CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "psw0"));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:QueryDatabaseAuthenticationHandlerTests.java


示例16: verifyAuthenticationInvalidSql

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Test
public void verifyAuthenticationInvalidSql() throws Exception {
    final QueryAndEncodeDatabaseAuthenticationHandler q = new QueryAndEncodeDatabaseAuthenticationHandler("", null, null, null, dataSource, ALG_NAME,
            buildSql("makesNoSenseInSql"), PASSWORD_FIELD_NAME, "salt", null, null, "ops", 0, "");

    this.thrown.expect(PreventedException.class);
    this.thrown.expectMessage("SQL exception while executing query for test");

    q.authenticate(CoreAuthenticationTestUtils.getCredentialsWithSameUsernameAndPassword());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:QueryAndEncodeDatabaseAuthenticationHandlerTests.java


示例17: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    CommonHelper.assertNotNull("profileCreator", this.profileCreator);

    final C credentials = convertToPac4jCredentials((I) credential);
    LOGGER.debug("credentials: [{}]", credentials);

    try {
        final Authenticator authenticator = getAuthenticator(credential);
 
        if (authenticator instanceof InitializableObject) {
            ((InitializableObject) authenticator).init();
        }
        if (authenticator instanceof InitializableWebObject) {
            ((InitializableWebObject) authenticator).init(getWebContext());
        }
        
        CommonHelper.assertNotNull("authenticator", authenticator);
        authenticator.validate(credentials, getWebContext());

        final UserProfile profile = this.profileCreator.create(credentials, getWebContext());
        LOGGER.debug("profile: [{}]", profile);

        return createResult(new ClientCredential(credentials), profile);
    } catch (final Exception e) {
        LOGGER.error("Failed to validate credentials", e);
        throw new FailedLoginException("Failed to validate credentials: " + e.getMessage());
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:30,代码来源:AbstractWrapperAuthenticationHandler.java


示例18: convertToPac4jCredentials

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected TokenCredentials convertToPac4jCredentials(final BasicIdentifiableCredential casCredential)
        throws GeneralSecurityException, PreventedException {
    LOGGER.debug("CAS credentials: [{}]", casCredential);

    final String id = this.principalNameTransformer.transform(casCredential.getId());
    if (id == null) {
        throw new AccountNotFoundException("Id is null.");
    }
    final TokenCredentials credentials = new TokenCredentials(id, getClass().getSimpleName());
    LOGGER.debug("pac4j credentials: [{}]", credentials);
    return credentials;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:14,代码来源:AbstractTokenWrapperAuthenticationHandler.java


示例19: convertToPac4jCredentials

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected UsernamePasswordCredentials convertToPac4jCredentials(final UsernamePasswordCredential casCredential)
        throws GeneralSecurityException, PreventedException {
    LOGGER.debug("CAS credentials: [{}]", casCredential);

    final String username = this.principalNameTransformer.transform(casCredential.getUsername());
    if (username == null) {
        throw new AccountNotFoundException("Username is null.");
    }
    final String password = this.passwordEncoder.encode(casCredential.getPassword());
    final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password, getClass().getSimpleName());
    LOGGER.debug("pac4j credentials: [{}]", credentials);
    return credentials;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:15,代码来源:UsernamePasswordWrapperAuthenticationHandler.java


示例20: doAuthentication

import org.apereo.cas.authentication.PreventedException; //导入依赖的package包/类
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
    try {
        final ClientCredential clientCredentials = (ClientCredential) credential;
        LOGGER.debug("clientCredentials  [{}]", clientCredentials);

        final Credentials credentials = clientCredentials.getCredentials();
        final String clientName = credentials.getClientName();
        LOGGER.debug("clientName:  [{}]", clientName);

        // get client
        final Client client = this.clients.findClient(clientName);
        LOGGER.debug("client: [{}]", client);

        // web context
        final HttpServletRequest request = WebUtils.getHttpServletRequest();
        final HttpServletResponse response = WebUtils.getHttpServletResponse();
        final WebContext webContext = WebUtils.getPac4jJ2EContext(request, response);

        // get user profile
        final UserProfile userProfile = client.getUserProfile(credentials, webContext);
        LOGGER.debug("userProfile: [{}]", userProfile);
        return createResult(clientCredentials, userProfile);
    } catch (final HttpAction e) {
        throw new PreventedException(e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:28,代码来源:ClientAuthenticationHandler.java



注:本文中的org.apereo.cas.authentication.PreventedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PduParser类代码示例发布时间:2022-05-22
下一篇:
Java NativeTypeTranslator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap