How to give username & password in a session?

Hi guys,

to begin I’m sorry, Im french and I don’t speak english very well.

For my work placement, I work with OpenFire. I must create a log with all connections (success and failure) at OpenFire. Connections are record in a MySQL Database.

I have developped three methods in LocalClientSession.java (org.jivesoftware.openfire.session) to give date creation of session, the id session and the IP adress of the client (with the object Connection).

Now, I want to give the UserName and Password used to try a connection but I don’t find how to do. For user name I have used session.getUserName() at the follow of my code for give date, id and ip adress but it return “null” and the exception UserNotFoundException, I don’t understand… For password I haven’t found method. Is it possible?

I continue my search, if you have an idea help me please.

Thanks,

Alex.

Hi,

I’m not a lawyer, but I think this is a critical feature and against the law of confidentiality or privacy rights (at least in Germany).

Hi,

It’s a work for medical domain and persons that access at OpenFire can potentially access to critical data. It’s very important to record these data to detect a possible intrusion attempt.

The network admin create users and give userName and password, he know already these data.

Moreover database is secured and declared to the french organism “CNIL”.

edit: I want to record only bad password, not good. But if it’s not possible, I record only userName and result of the connection (0 for failure, 1 for success), but I don’t know how to do either to give it.

Alex

you can know how user is conected using this:

<jsp:useBean id=“webManager” class=“org.jivesoftware.util.WebManager” />
<% webManager.init(request, response, session, application, out ); %>

PresenceManager presenceManager = webManager.getPresenceManager();

<% if (presenceManager.isAvailable(user)) {
Presence presence = presenceManager.getPresence(user);

if (presence.getShow() == null) { %>
user is available
<% }

if (presence.getShow() == Presence.Show.chat) { %>
user is chat_available
<% }
if (presence.getShow() == Presence.Show.away) { %>
user is away
<% } %>

Hi Jon,

Thanks for help but I don’t work with jsp and I think I’do not need. I work with the java client.

I saw the package org.jivesoftware.openfire.auth, it contains a lot of classes concerning connection. UserName and password transit by these classes and the AuthToken proves user is connected, I think I will try to use it to resolve my problem. However, if you have others ideas or if it doesn’t work, I always listening you.

Alex

i think the authtoken is to control the users how are logined in the server, not for the client users

to control the client users state is using the presence class