Hi all,

I can get the admin service auth cookie by calling required service stubs
like below

var log = new Log();
var HTTPConstants = Packages.org.apache.axis2.transport.http.HTTPConstants;

var AuthStub =
Packages.org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
var AUTH_SERVICE = 'https://localhost:9443/services/AuthenticationAdmin';
var authAdminClient = new AuthStub(AUTH_SERVICE);

var userName = 'admin';
var password = 'admin';
if (authAdminClient.login(userName, password, "localhost")) {
    var serviceContext =
authAdminClient._getServiceClient().getLastOperationContext().getServiceContext();
    var sessionCookie =
serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    log.info('Session cookie ' + sessionCookie);
} else {
    log.info('Authentication failure');
}

But is there any built-in way  to get the admin service cookie in Jaggery?

-- 
Regards,

Dunith Dhanushka,
Senior Software Engineer - BAM,
WSO2 Inc,

Mobile - +94 71 8615744
Blog - dunithd.wordpress.com <http://blog.dunith.com>
Twitter - @dunithd <http://twitter.com/dunithd>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to