/*
 * oxTrust is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.gluu.oxauth.client;

import java.util.Map;

import org.gluu.oxauth.client.auth.principal.OpenIdCredentials;
import org.gluu.oxauth.client.auth.user.UserProfile;
import org.xdi.context.WebContext;

/**
 * This interface represents a client
 * 
 * @author Yuriy Movchan 11/14/2014
 */
public interface Client<U extends UserProfile> {

	/**
	 * Get the name of the client
	 * 
	 * @return the name of the client
	 */
	public String getName();

	/**
	 * Get url for oxAuth authentication
	 * 
	 * @param context
	 * @return url with authorization request
	 */
	public String getRedirectionUrl(final WebContext context);

    /**
     * Get url for oxAuth authentication
     * 
     * @param context
     * @param customStateParameters
     * @param customParameters
     * @return url with authorization request
     */
	public String getRedirectionUrl(final WebContext context, Map<String, String> customStateParameters, final Map<String, String> customParameters);

    /**
     * Get logout url for oxAuth authentication
     * 
     * @param context
     * @return logout url with authorization request
     */
    public String getLogoutRedirectionUrl(final WebContext context);

	/**
	 * Check if web context provides authentication credentials
	 * 
	 * @param context
	 * @return result of check
	 */
	public boolean isAuthorizationResponse(final WebContext context);

    /**
     * Check if web context provides contain id_token
     * 
     * @param context
     * @return result of check
     */
    boolean isAuthorized(WebContext context);

    /**
     * Remove id_token from web context
     * 
     * @param context
     * @return result of check
     */
    void clearAuthorized(WebContext context);

	/**
	 * Check if request state is valid
	 * 
	 * @param context
	 * @return result of check
	 */
	public boolean isValidRequestState(final WebContext context);

	/**
     * Get state parameter from request
     * 
     * @param context
     * @return result of check
     */
    public String getRequestState(final WebContext context);

	/**
	 * Get the credentials from the web context
	 * 
	 * @param context
	 * @return the credentials
	 */
	public OpenIdCredentials getCredentials(final WebContext context);

	/**
	 * Get the user profile from the credentials and web context
	 * 
	 * @param credentials
	 * @param context
	 * @return the user profile
	 */
	public U getUserProfile(final OpenIdCredentials credentials, final WebContext context);

    void setAttribute(WebContext context, String attributeName, Object attributeValue);

    Object getAttribute(WebContext context, String attributeName);

}

@@ -490,2050 +490,669 @@
 %7B%0A%0A%09
-/**%0A%09 * Get the name of the client%0A%09 * %0A%09 * @return the name of the client%0A%09 */%0A%09public String getName();%0A%0A%09/**%0A%09 * Get url for oxAuth authentication%0A%09 * %0A%09 * @param context%0A%09 * @return url with authorization request%0A%09 */%0A%09public String getRedirectionUrl(final WebContext context);%0A%0A    /**%0A     * Get url for oxAuth authentication%0A     * %0A     * @param context%0A     * @param customStateParameters%0A     * @param customParameters%0A     * @return url with authorization request%0A     */%0A%09public String getRedirectionUrl(final WebContext context, Map%3CString, String%3E customStateParameters, final Map%3CString, String%3E customParameters);%0A%0A    /**%0A     * Get logout url for oxAuth authentication%0A     * %0A     * @param context%0A     * @return logout url with authorization request%0A     */%0A    public String getLogoutRedirectionUrl(final WebContext context);%0A%0A%09/**%0A%09 * Check if web context provides authentication credentials%0A%09 * %0A%09 * @param context%0A%09 * @return result of check%0A%09 */%0A%09public boolean isAuthorizationResponse(final WebContext context);%0A%0A    /**%0A     * Check if web context provides contain id_token%0A     * %0A     * @param context%0A     * @return result of check%0A     */%0A    boolean isAuthorized(WebContext context);%0A%0A    /**%0A     * Remove id_token from web context%0A     * %0A     * @param context%0A     * @return result of check%0A     */%0A    void clearAuthorized(WebContext context);%0A%0A%09/**%0A%09 * Check if request state is valid%0A%09 * %0A%09 * @param context%0A%09 * @return result of check%0A%09 */%0A%09public boolean isValidRequestState(final WebContext context);%0A%0A%09/**%0A     * Get state parameter from request%0A     * %0A     * @param context%0A     * @return result of check%0A     */%0A    public String getRequestState(final WebContext context);%0A%0A%09/**%0A%09 * Get the credentials from the web context%0A%09 * %0A%09 * @param context%0A%09 * @return the credentials%0A%09 */%0A%09public OpenIdCredentials getCredentials(final WebContext context);%0A%0A%09/**%0A%09 * Get the user profile from the credentials and web context%0A%09 * %0A%09 * @param credentials%0A%09 * @param context%0A%09 * @return the user profile%0A%09 */
+public String getName();%0A%0A%09public String getRedirectionUrl(final WebContext context);%0A%0A%09public String getRedirectionUrl(final WebContext context, Map%3CString, String%3E customStateParameters, final Map%3CString, String%3E customParameters);%0A%0A    public String getLogoutRedirectionUrl(final WebContext context);%0A%0A%09public boolean isAuthorizationResponse(final WebContext context);%0A%0A    boolean isAuthorized(WebContext context);%0A%0A    void clearAuthorized(WebContext context);%0A%0A%09public boolean isValidRequestState(final WebContext context);%0A%0A    public String getRequestState(final WebContext context);%0A%0A%09public OpenIdCredentials getCredentials(final WebContext context);%0A
 %0A%09pu

Fix compilation error on Jenkins build #1510