package com.oracle.maf.sample.mcs.shared.authorization.oauth;

import com.oracle.maf.sample.mcs.shared.authorization.auth.Authorization;
import com.oracle.maf.sample.mcs.shared.exceptions.ServiceProxyException;
import com.oracle.maf.sample.mcs.shared.mbe.MBE;
import com.oracle.maf.sample.mcs.shared.mbe.MBEConfiguration;

import java.util.HashMap;

/**
 * Using mobile backends gives you a unified security context for your APIs. By default, APIs require user authentication
 * before they can be accessed. To reach an API that is configured to require authenticated access, a mobile app needs to
 * provide the credentials for the mobile backend (along with user credentials).
 *
 * @author   Frank Nimphius
 * @copyright Copyright (c) 2015 Oracle. All rights reserved.
 */
public final class OauthAuthorization implements Authorization{
    
//todo implement OAUTH    
  

    private String mobileBackendID  = null; 

    private String authenticatedUsername = null;

    private MBEConfiguration mbeConfig     = null;
    private MBE mobileBackend = null;

    
    public OauthAuthorization(MBE mbe) {
        super();
        
        this.mobileBackend = mbe;
        this.mbeConfig = mobileBackend.getMbeConfiguration();        
        this.mobileBackendID = mbeConfig.getMobileBackendId();

//todo add more
    }



    @Override
    public String getUsername() {
        // TODO Implement this method
        return null;
    }

    /**
     * Returns the OAuth authorizationProvider token for when users authenticated through MAF MCS Utility. For users that
     * authenticate through MAF Features or users that are not authenticated, this method returns an empty map
     *
     * @return the OAuth authentication token as a base64 encoded string in a map or an empty map if authentication
     * isn't performed through MAF MCS Util or is performed on the MAF Feature level
     */
    @Override
    public HashMap<String, String> getHTTPAuthorizationHeader() {
        // TODO Implement this method
        return null;
    }

    @Override
    public void authenticate(String username, String password) throws IllegalArgumentException,ServiceProxyException{
        // TODO Implement this method

    }

    @Override
    public void logout() throws ServiceProxyException {
        // TODO Implement this method
    }

    @Override
    public void authenticateAsAnonymous() throws ServiceProxyException {
        // TODO Implement this method
    }

    @Override
    public boolean isAnonymousAuthentication() {
        // TODO Implement this method
        return false;
    }
}
