Java Code Examples for org.wso2.carbon.apimgt.impl.APIConstants#AUTHORIZATION_HEADER_BASIC

The following examples show how to use org.wso2.carbon.apimgt.impl.APIConstants#AUTHORIZATION_HEADER_BASIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSO2APIPublisher.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Get Basic Authorization header for external store admin credentials.
 *
 * @param store External Store config
 * @return Base64 encoded Basic Authorization header
 */
private String getBasicAuthorizationHeader(APIStore store) {

    //Set Authorization Header of external store admin
    byte[] encodedAuth = Base64
            .encodeBase64((store.getUsername() + ":" + store.getPassword()).getBytes(StandardCharsets.ISO_8859_1));
    return APIConstants.AUTHORIZATION_HEADER_BASIC + StringUtils.SPACE + new String(encodedAuth);
}
 
Example 2
Source File: KeyMgtRegistrationService.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * Get Basic Authorization header for KM admin credentials.
 *
 * @return Base64 encoded Basic Authorization header
 */
private static String getBasicAuthorizationHeader(String username, String password) {

    //Set Authorization Header of external store admin
    byte[] encodedAuth = Base64.encodeBase64((username + ":" + password).getBytes(StandardCharsets.ISO_8859_1));
    return APIConstants.AUTHORIZATION_HEADER_BASIC + StringUtils.SPACE + new String(encodedAuth);
}