All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.covisint.platform.oauth.client.token.TokenClient Maven / Gradle / Ivy

The newest version!
/* 
 * Copyright 2015 Covisint
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.covisint.platform.oauth.client.token;

import org.apache.http.protocol.HttpContext;

import com.covisint.core.http.service.client.ResourceClient;
import com.covisint.core.http.service.core.ServiceException;
import com.covisint.core.support.constraint.Nonnull;
import com.covisint.core.support.constraint.NotEmpty;
import com.covisint.core.support.constraint.Nullable;
import com.covisint.platform.oauth.core.token.Token;
import com.google.common.util.concurrent.CheckedFuture;

/** Client for reading and updating information about token. */
public interface TokenClient extends ResourceClient {

    /**
     * Generate token for client credentials.
     * 
     * @param clientId the client id.
     * @param clientSecret the client secret.
     * @param httpContext the http context.
     * @return Generate token for client credentials.
     */
    @Nonnull 
    CheckedFuture getToken(@Nonnull @NotEmpty String clientId,
            @Nonnull @NotEmpty String clientSecret, @Nonnull HttpContext httpContext);

    /**
     * Generate token for client credentials via post.
     * 
     * @param clientId the client id.
     * @param clientSecret the client secret.
     * @param httpContext the http context.
     * @return Generate token for client credentials.
     */
    @Nonnull 
    CheckedFuture postAccessToken(@Nonnull @NotEmpty String clientId,
            @Nonnull @NotEmpty String clientSecret, @Nonnull HttpContext httpContext);

    /**
     * generate token for certificate.
     * 
     * @param clientId the grant type id.
     * @param certificate the certificate
     * @param publickey the public key
     * @param x509RequestAttributeName the X509 request attribute Name
     * @param httpContext httpContext the http context.
     * @return Generate token for certificate.
     */
    @Nonnull 
    CheckedFuture getToken(@Nonnull @NotEmpty String clientId,
            @Nullable String certificate, @Nullable String publickey, @Nullable String x509RequestAttributeName,
            @Nonnull HttpContext httpContext);

    /**
     * generate token for certificate via post.
     * 
     * @param clientId the grant type id.
     * @param certificate the certificate
     * @param publickey the public key
     * @param x509RequestAttributeName the X509 request attribute Name
     * @param httpContext httpContext the http context.
     * @return Generate token for certificate.
     */
    @Nonnull 
    CheckedFuture postAccessToken(@Nonnull @NotEmpty String clientId,
            @Nullable String certificate, @Nullable String publickey, @Nullable String x509RequestAttributeName,
            @Nonnull HttpContext httpContext);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy