Search in sources :

Example 1 with BasicAuthHandler

use of org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler in project carbon-identity-framework by wso2.

the class ApplicationInitializer method initEntitlementAuthenticatorRegistry.

private void initEntitlementAuthenticatorRegistry() {
    EntitlementAuthenticatorRegistry entitlementAuthRegistry = EntitlementAuthenticatorRegistry.getInstance();
    if (entitlementAuthRegistry != null) {
        // set authenticators after building auth config
        EntitlementAuthConfigReader configReader = new EntitlementAuthConfigReader();
        List<EntitlementAuthenticationHandler> entitlementAuthenticators = configReader.buildEntitlementAuthenticators();
        if (entitlementAuthenticators != null && !entitlementAuthenticators.isEmpty()) {
            for (EntitlementAuthenticationHandler entitlementAuthenticator : entitlementAuthenticators) {
                entitlementAuthRegistry.setAuthenticator(entitlementAuthenticator);
            }
        } else {
            // initialize default basic auth authenticator & OAuth authenticator and set it in the auth registry.
            BasicAuthHandler basicAuthHandler = new BasicAuthHandler();
            basicAuthHandler.setDefaultPriority();
            entitlementAuthRegistry.setAuthenticator(basicAuthHandler);
        }
    }
}
Also used : EntitlementAuthenticatorRegistry(org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthenticatorRegistry) EntitlementAuthenticationHandler(org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthenticationHandler) BasicAuthHandler(org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler) EntitlementAuthConfigReader(org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthConfigReader)

Example 2 with BasicAuthHandler

use of org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler in project product-is by wso2.

the class ProvisioningTestCase method getBasicAuthInfo.

private BasicAuthInfo getBasicAuthInfo(AutomationContext context) throws XPathExpressionException {
    BasicAuthInfo basicAuthInfo = new BasicAuthInfo();
    basicAuthInfo.setUserName(context.getSuperTenant().getTenantAdmin().getUserName());
    basicAuthInfo.setPassword(context.getSuperTenant().getTenantAdmin().getPassword());
    BasicAuthHandler basicAuthHandler = new BasicAuthHandler();
    return (BasicAuthInfo) basicAuthHandler.getAuthenticationToken(basicAuthInfo);
}
Also used : BasicAuthHandler(org.wso2.identity.integration.test.utils.BasicAuthHandler) BasicAuthInfo(org.wso2.identity.integration.test.utils.BasicAuthInfo)

Example 3 with BasicAuthHandler

use of org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler in project product-is by wso2.

the class SCIMUtils method getBasicAuthInfo.

/**
 * Construct and return basic authentication information of the given user.
 *
 * @param userInfo user representation
 * @return         BasicAuthInfo instance containing user authentication information
 */
public static BasicAuthInfo getBasicAuthInfo(org.wso2.carbon.automation.engine.context.beans.User userInfo) {
    BasicAuthInfo basicAuthInfo = new BasicAuthInfo();
    basicAuthInfo.setUserName(userInfo.getUserName());
    basicAuthInfo.setPassword(userInfo.getPassword());
    BasicAuthHandler basicAuthHandler = new BasicAuthHandler();
    return (BasicAuthInfo) basicAuthHandler.getAuthenticationToken(basicAuthInfo);
}
Also used : BasicAuthHandler(org.wso2.identity.integration.test.utils.BasicAuthHandler) BasicAuthInfo(org.wso2.identity.integration.test.utils.BasicAuthInfo)

Example 4 with BasicAuthHandler

use of org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler in project product-is by wso2.

the class Utils method getBasicAuthHeader.

/**
 * Construct and return basic authentication information of the user.
 */
public static String getBasicAuthHeader(User userInfo) {
    BasicAuthInfo basicAuthInfo = new BasicAuthInfo();
    basicAuthInfo.setUserName(userInfo.getUserName());
    basicAuthInfo.setPassword(userInfo.getPassword());
    BasicAuthHandler basicAuthHandler = new BasicAuthHandler();
    BasicAuthInfo encodedBasicAuthInfo = (BasicAuthInfo) basicAuthHandler.getAuthenticationToken(basicAuthInfo);
    return encodedBasicAuthInfo.getAuthorizationHeader();
}
Also used : BasicAuthHandler(org.wso2.identity.integration.test.utils.BasicAuthHandler) BasicAuthInfo(org.wso2.identity.integration.test.utils.BasicAuthInfo)

Example 5 with BasicAuthHandler

use of org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler in project product-is by wso2.

the class MasterSCIMInitiator method getBasicAuthInfo.

protected BasicAuthInfo getBasicAuthInfo(org.wso2.carbon.automation.engine.context.beans.User provider_userInfo) {
    BasicAuthInfo basicAuthInfo = new BasicAuthInfo();
    basicAuthInfo.setUserName(provider_userInfo.getUserName());
    basicAuthInfo.setPassword(provider_userInfo.getPassword());
    BasicAuthHandler basicAuthHandler = new BasicAuthHandler();
    return (BasicAuthInfo) basicAuthHandler.getAuthenticationToken(basicAuthInfo);
}
Also used : BasicAuthHandler(org.wso2.identity.integration.test.utils.BasicAuthHandler) BasicAuthInfo(org.wso2.identity.integration.test.utils.BasicAuthInfo)

Aggregations

BasicAuthHandler (org.wso2.identity.integration.test.utils.BasicAuthHandler)4 BasicAuthInfo (org.wso2.identity.integration.test.utils.BasicAuthInfo)4 BasicAuthHandler (org.wso2.carbon.identity.entitlement.endpoint.auth.BasicAuthHandler)1 EntitlementAuthConfigReader (org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthConfigReader)1 EntitlementAuthenticationHandler (org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthenticationHandler)1 EntitlementAuthenticatorRegistry (org.wso2.carbon.identity.entitlement.endpoint.auth.EntitlementAuthenticatorRegistry)1