Search in sources :

Example 1 with UserCredentials

use of org.jivesoftware.openfire.sip.tester.security.UserCredentials in project Openfire by igniterealtime.

the class SipManager method startRegisterProcess.

public void startRegisterProcess(String userName, String authUserName, String password) throws CommunicationsException {
    try {
        checkIfStarted();
        // Obtain initial credentials
        String realm = SIPConfig.getAuthenticationRealm();
        realm = realm == null ? "" : realm;
        // put the returned user name in the properties file
        // so that it appears as a default one next time user is prompted
        // for pass
        SIPConfig.setUserName(userName);
        SIPConfig.setAuthUserName(authUserName);
        UserCredentials initialCredentials = new UserCredentials();
        initialCredentials.setUserName(userName);
        initialCredentials.setAuthUserName(authUserName);
        initialCredentials.setPassword(password.toCharArray());
        register(initialCredentials.getUserName() + "@" + realm);
        // at this point a simple register request has been sent and the
        // global
        // from header in SipManager has been set to a valid value by the
        // RegisterProcesing
        // class. Use it to extract the valid user name that needs to be
        // cached by
        // the security manager together with the user provided password.
        initialCredentials.setUserName(((SipURI) getFromHeader().getAddress().getURI()).getUser());
        // JOptionPane.showMessageDialog(null,( (SipURI)
        // getFromHeader().getAddress().getURI()).getUser());
        cacheCredentials(realm, initialCredentials);
    } catch (Exception ee) {
        Log.error("startRegisterProcess", ee);
    }
}
Also used : UserCredentials(org.jivesoftware.openfire.sip.tester.security.UserCredentials) TooManyListenersException(java.util.TooManyListenersException) UnknownHostException(java.net.UnknownHostException) CommunicationsException(org.jivesoftware.openfire.sip.tester.comm.CommunicationsException) ParseException(java.text.ParseException)

Aggregations

UnknownHostException (java.net.UnknownHostException)1 ParseException (java.text.ParseException)1 TooManyListenersException (java.util.TooManyListenersException)1 CommunicationsException (org.jivesoftware.openfire.sip.tester.comm.CommunicationsException)1 UserCredentials (org.jivesoftware.openfire.sip.tester.security.UserCredentials)1