當前位置: 首頁>>代碼示例>>Java>>正文


Java AuthSchemes.SPNEGO屬性代碼示例

本文整理匯總了Java中org.apache.http.client.config.AuthSchemes.SPNEGO屬性的典型用法代碼示例。如果您正苦於以下問題:Java AuthSchemes.SPNEGO屬性的具體用法?Java AuthSchemes.SPNEGO怎麽用?Java AuthSchemes.SPNEGO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.http.client.config.AuthSchemes的用法示例。


在下文中一共展示了AuthSchemes.SPNEGO屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toApacheAuthenticationScheme

/**
 * Convert the customer-facing authentication method into an apache-specific authentication method.
 */
private String toApacheAuthenticationScheme(ProxyAuthenticationMethod authenticationMethod) {
    if (authenticationMethod == null) {
        throw new IllegalStateException("The configured proxy authentication methods must not be null.");
    }

    switch (authenticationMethod) {
        case NTLM: return AuthSchemes.NTLM;
        case BASIC: return AuthSchemes.BASIC;
        case DIGEST: return AuthSchemes.DIGEST;
        case SPNEGO: return AuthSchemes.SPNEGO;
        case KERBEROS: return AuthSchemes.KERBEROS;
        default: throw new IllegalStateException("Unknown authentication scheme: " + authenticationMethod);
    }
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:17,代碼來源:ApacheHttpRequestFactory.java

示例2: KerberosHttpClient

private KerberosHttpClient(String user, String password, String domain, String kdc) {
    try {
        File krb5Config = createKrb5Configuration(domain, kdc);
        File loginConfig = createLoginConfiguration();

        System.setProperty("java.security.auth.login.config", loginConfig.toURI().toString());
        System.setProperty("java.security.krb5.conf", krb5Config.toURI().toString());
        System.setProperty("sun.security.krb5.debug", "false");
        //Change this property to true, if you want debug output.
        System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");

        RegistryBuilder<AuthSchemeProvider> registryBuilder = RegistryBuilder.create();
        String id = AuthSchemes.SPNEGO;
        SPNegoSchemeFactory schemeFactory = new SPNegoSchemeFactory(SKIP_PORT_AT_KERBEROS_DATABASE_LOOKUP);
        Lookup<AuthSchemeProvider> authSchemeRegistry = registryBuilder.register(id, schemeFactory).build();

        client = HttpClients.custom().setDefaultAuthSchemeRegistry(authSchemeRegistry)
                .setConnectionManager(createConnectionManager()).build();
        httpContext = getHttpContext();
        loginContext = getLoginContext(user, password);

        //without it, authentication will be failed.
        final Subject subject = loginContext.getSubject();
        final HttpGet get = new HttpGet(KerberosBpmClient.this.rootUri);
        Subject.doAs(subject, this.privilegedExecute(get, httpContext));
    } catch (Exception e) {
        logger.error("Can't create Kerberos client!");
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
 
開發者ID:egetman,項目名稱:ibm-bpm-rest-client,代碼行數:31,代碼來源:KerberosBpmClient.java

示例3: WindowsNegotiateScheme

public WindowsNegotiateScheme(final String scheme, final String servicePrincipalName) {
    super();

    this.scheme = (scheme == null) ? AuthSchemes.SPNEGO : scheme;
    this.challenge = null;
    this.continueNeeded = true;
    this.servicePrincipalName = servicePrincipalName;

    if (this.log.isDebugEnabled()) {
        this.log.debug("Created WindowsNegotiateScheme using " + this.scheme);
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:12,代碼來源:WindowsNegotiateScheme.java

示例4: create

@Override
public AuthScheme create(final HttpContext context) {
    return new WindowsNegotiateScheme(AuthSchemes.SPNEGO, servicePrincipalName);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:4,代碼來源:WindowsNegotiateSchemeFactory.java

示例5: getSchemeName

@Override
public String getSchemeName() {
    return AuthSchemes.SPNEGO;
}
 
開發者ID:cloudsoft,項目名稱:winrm4j,代碼行數:4,代碼來源:ApacheSpnegoScheme.java


注:本文中的org.apache.http.client.config.AuthSchemes.SPNEGO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。