You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by "Wright, Omari" <Om...@solers.com> on 2012/07/13 14:41:11 UTC

[Apache SSHD] Question about authentication

I have OpenAM which I plan to use to handle user authentication again an Active Directory server. I plan to make a call during the SSHD authenticate method passing along username/password. The returned value of this call is a token id if it is successful and null otherwise. I then want to associate this value with the session as a type of session id. Is this possible? If so, how can I go about doing this?

The token id would basically be an added property on the session. The reason I want this functionality is that I then want to be able to kick users based off the token id passed to the disconnect method. The reason for this is a need to have OpenAM manage user disconnects.

Re: [Apache SSHD] Question about authentication

Posted by Guillaume Nodet <gn...@gmail.com>.
IoSession are given to ServerSession as parameters when those are built.
You can access the IoSession using
   IoSession AbstractSession#getIoSession()
and get the ServerSession from a IoSession using
   AbstractSession AbstractSession#getSession(IoSession session)

They don't share attributes though.

On Fri, Jul 13, 2012 at 3:06 PM, Wright, Omari <Om...@solers.com>wrote:

> Does it matter that the type of sessions returned by
> acceptor.getManagedSessions() are IoSessions instead of ServerSessions or
> do they access the same attributes?
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 8:49 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> The UserAuth interface you'll have to implement is given the ServerSession
> as a parameter and you can use get/setAttributes() to associate your id
> with the ssh session.
> When you want to kick users, you can enumerate the sessions using
> sshServer.getActiveSessions() and check what you need there, eventually
> calling close() on the sessions.
>
> On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari <Omari.Wright@solers.com
> >wrote:
>
> > I have OpenAM which I plan to use to handle user authentication again
> > an Active Directory server. I plan to make a call during the SSHD
> > authenticate method passing along username/password. The returned
> > value of this call is a token id if it is successful and null
> > otherwise. I then want to associate this value with the session as a
> > type of session id. Is this possible? If so, how can I go about doing
> this?
> >
> > The token id would basically be an added property on the session. The
> > reason I want this functionality is that I then want to be able to
> > kick users based off the token id passed to the disconnect method. The
> > reason for this is a need to have OpenAM manage user disconnects.
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

RE: [Apache SSHD] Question about authentication

Posted by "Wright, Omari" <Om...@solers.com>.
Does it matter that the type of sessions returned by acceptor.getManagedSessions() are IoSessions instead of ServerSessions or do they access the same attributes?

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Friday, July 13, 2012 8:49 AM
To: users@mina.apache.org
Subject: Re: [Apache SSHD] Question about authentication

The UserAuth interface you'll have to implement is given the ServerSession as a parameter and you can use get/setAttributes() to associate your id with the ssh session.
When you want to kick users, you can enumerate the sessions using
sshServer.getActiveSessions() and check what you need there, eventually calling close() on the sessions.

On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari <Om...@solers.com>wrote:

> I have OpenAM which I plan to use to handle user authentication again 
> an Active Directory server. I plan to make a call during the SSHD 
> authenticate method passing along username/password. The returned 
> value of this call is a token id if it is successful and null 
> otherwise. I then want to associate this value with the session as a 
> type of session id. Is this possible? If so, how can I go about doing this?
>
> The token id would basically be an added property on the session. The 
> reason I want this functionality is that I then want to be able to 
> kick users based off the token id passed to the disconnect method. The 
> reason for this is a need to have OpenAM manage user disconnects.
>



--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: [Apache SSHD] Question about authentication

Posted by Guillaume Nodet <gn...@gmail.com>.
I suppose that can happen for session that are not authenticated yet, but
otherwise it should work if you defined getTokenId as
session.getAttribute(TOKEN_ID)



On Mon, Jul 23, 2012 at 3:29 PM, Wright, Omari <Om...@solers.com>wrote:

> When I get the list of active sessions and try to get the token id, it is
> null.
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 20, 2012 4:09 PM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> Looks good at a first glance.  What's the problem ?
>
> On Fri, Jul 20, 2012 at 7:26 PM, Wright, Omari <Omari.Wright@solers.com
> >wrote:
>
> > I'm still having problems accessing an attribute in the list of
> > managed sessions.
> >
> > public static final AttributeKey<TokenId> TOKEN_ID = new
> > AttributeKey<TokenId>();
> >
> > public boolean authenticate(String username, String password,
> > ServerSession session) {
> >                 PdaUserManager userManager = (PdaUserManager)
> >
> session.getServerFactoryManager().getUserManagerFactory().createUserManager();
> >                 Authentication auth = new
> > UsernamePasswordAuthentication(username, password);
> >
> >                 try {
> >                                         String returnVal =
> > userManager.authenticateSshd(auth);
> >                                         TokenId tokenId = new
> > TokenId(returnVal);
> >                                         session.setAttribute(TOKEN_ID,
> > tokenId);
> >                                 } catch (AuthenticationFailedException
> e) {
> >                                         return false;
> >                                 }
> >
> >                 return true;
> >             }
> >
> > _____________________________
> >
> > Then in another class I try:
> >
> > public static boolean disconnectByTokenId(String tokenId) {
> >                 List<AbstractSession> sessions =
> > server.getActiveSessions();
> >                 for (AbstractSession session : sessions) {
> >                         if (session != null
> >                                         &&
> >
> SshServer.getTokenId(session).getValue().equalsIgnoreCase(sessionTokenId)) {
> >                                 session.close(true);
> >                                 return true;
> >                         }
> >                 }
> >
> >                 return false;
> >         }
> >
> >
> > -----Original Message-----
> > From: Guillaume Nodet [mailto:gnodet@gmail.com]
> > Sent: Friday, July 13, 2012 9:30 AM
> > To: users@mina.apache.org
> > Subject: Re: [Apache SSHD] Question about authentication
> >
> > Attributes are supposed to be used the following way
> >
> >       private static final AttributeKey<MyValue> MY_KEY = new
> > AttributeKey<MyValue>();
> >
> >       public static MyValue getMyValue(Session s) {
> >         return s.getAttribute(MY_KEY);
> >       }
> >
> >       private void setMyValue(Session s, MyValue value) {
> >         s.setAttribute(MY_KEY, value);
> >       }
> >
> >
> > On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari
> > <Omari.Wright@solers.com
> > >wrote:
> >
> > > Also, does that AttributeKey that I set have to be its own data type?
> > >
> > > -----Original Message-----
> > > From: Guillaume Nodet [mailto:gnodet@gmail.com]
> > > Sent: Friday, July 13, 2012 8:49 AM
> > > To: users@mina.apache.org
> > > Subject: Re: [Apache SSHD] Question about authentication
> > >
> > > The UserAuth interface you'll have to implement is given the
> > > ServerSession as a parameter and you can use get/setAttributes() to
> > > associate your id with the ssh session.
> > > When you want to kick users, you can enumerate the sessions using
> > > sshServer.getActiveSessions() and check what you need there,
> > > eventually calling close() on the sessions.
> > >
> > > On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari
> > > <Omari.Wright@solers.com
> > > >wrote:
> > >
> > > > I have OpenAM which I plan to use to handle user authentication
> > > > again an Active Directory server. I plan to make a call during the
> > > > SSHD authenticate method passing along username/password. The
> > > > returned value of this call is a token id if it is successful and
> > > > null otherwise. I then want to associate this value with the
> > > > session as a type of session id. Is this possible? If so, how can
> > > > I go about doing
> > > this?
> > > >
> > > > The token id would basically be an added property on the session.
> > > > The reason I want this functionality is that I then want to be
> > > > able to kick users based off the token id passed to the disconnect
> > > > method. The reason for this is a need to have OpenAM manage user
> > disconnects.
> > > >
> > >
> > >
> > >
> > > --
> > > ------------------------
> > > Guillaume Nodet
> > > ------------------------
> > > Blog: http://gnodet.blogspot.com/
> > > ------------------------
> > > FuseSource, Integration everywhere
> > > http://fusesource.com
> > >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > FuseSource, Integration everywhere
> > http://fusesource.com
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

RE: [Apache SSHD] Question about authentication

Posted by "Wright, Omari" <Om...@solers.com>.
Nevermind, it works. It was user error... I defined the PasswordAuthenticator somewhere it wasn't being used.

-----Original Message-----
From: Wright, Omari [mailto:Omari.Wright@solers.com] 
Sent: Monday, July 23, 2012 9:30 AM
To: users@mina.apache.org
Subject: RE: [Apache SSHD] Question about authentication

When I get the list of active sessions and try to get the token id, it is null.

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com]
Sent: Friday, July 20, 2012 4:09 PM
To: users@mina.apache.org
Subject: Re: [Apache SSHD] Question about authentication

Looks good at a first glance.  What's the problem ?

On Fri, Jul 20, 2012 at 7:26 PM, Wright, Omari <Om...@solers.com>wrote:

> I'm still having problems accessing an attribute in the list of 
> managed sessions.
>
> public static final AttributeKey<TokenId> TOKEN_ID = new 
> AttributeKey<TokenId>();
>
> public boolean authenticate(String username, String password, 
> ServerSession session) {
>                 PdaUserManager userManager = (PdaUserManager) 
> session.getServerFactoryManager().getUserManagerFactory().createUserManager();
>                 Authentication auth = new 
> UsernamePasswordAuthentication(username, password);
>
>                 try {
>                                         String returnVal = 
> userManager.authenticateSshd(auth);
>                                         TokenId tokenId = new 
> TokenId(returnVal);
>                                         session.setAttribute(TOKEN_ID, 
> tokenId);
>                                 } catch (AuthenticationFailedException e) {
>                                         return false;
>                                 }
>
>                 return true;
>             }
>
> _____________________________
>
> Then in another class I try:
>
> public static boolean disconnectByTokenId(String tokenId) {
>                 List<AbstractSession> sessions = 
> server.getActiveSessions();
>                 for (AbstractSession session : sessions) {
>                         if (session != null
>                                         &&
> SshServer.getTokenId(session).getValue().equalsIgnoreCase(sessionTokenId)) {
>                                 session.close(true);
>                                 return true;
>                         }
>                 }
>
>                 return false;
>         }
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 9:30 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> Attributes are supposed to be used the following way
>
>       private static final AttributeKey<MyValue> MY_KEY = new 
> AttributeKey<MyValue>();
>
>       public static MyValue getMyValue(Session s) {
>         return s.getAttribute(MY_KEY);
>       }
>
>       private void setMyValue(Session s, MyValue value) {
>         s.setAttribute(MY_KEY, value);
>       }
>
>
> On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari 
> <Omari.Wright@solers.com
> >wrote:
>
> > Also, does that AttributeKey that I set have to be its own data type?
> >
> > -----Original Message-----
> > From: Guillaume Nodet [mailto:gnodet@gmail.com]
> > Sent: Friday, July 13, 2012 8:49 AM
> > To: users@mina.apache.org
> > Subject: Re: [Apache SSHD] Question about authentication
> >
> > The UserAuth interface you'll have to implement is given the 
> > ServerSession as a parameter and you can use get/setAttributes() to 
> > associate your id with the ssh session.
> > When you want to kick users, you can enumerate the sessions using
> > sshServer.getActiveSessions() and check what you need there, 
> > eventually calling close() on the sessions.
> >
> > On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari 
> > <Omari.Wright@solers.com
> > >wrote:
> >
> > > I have OpenAM which I plan to use to handle user authentication 
> > > again an Active Directory server. I plan to make a call during the 
> > > SSHD authenticate method passing along username/password. The 
> > > returned value of this call is a token id if it is successful and 
> > > null otherwise. I then want to associate this value with the 
> > > session as a type of session id. Is this possible? If so, how can 
> > > I go about doing
> > this?
> > >
> > > The token id would basically be an added property on the session.
> > > The reason I want this functionality is that I then want to be 
> > > able to kick users based off the token id passed to the disconnect 
> > > method. The reason for this is a need to have OpenAM manage user
> disconnects.
> > >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > FuseSource, Integration everywhere
> > http://fusesource.com
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

RE: [Apache SSHD] Question about authentication

Posted by "Wright, Omari" <Om...@solers.com>.
When I get the list of active sessions and try to get the token id, it is null.

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Friday, July 20, 2012 4:09 PM
To: users@mina.apache.org
Subject: Re: [Apache SSHD] Question about authentication

Looks good at a first glance.  What's the problem ?

On Fri, Jul 20, 2012 at 7:26 PM, Wright, Omari <Om...@solers.com>wrote:

> I'm still having problems accessing an attribute in the list of 
> managed sessions.
>
> public static final AttributeKey<TokenId> TOKEN_ID = new 
> AttributeKey<TokenId>();
>
> public boolean authenticate(String username, String password, 
> ServerSession session) {
>                 PdaUserManager userManager = (PdaUserManager) 
> session.getServerFactoryManager().getUserManagerFactory().createUserManager();
>                 Authentication auth = new 
> UsernamePasswordAuthentication(username, password);
>
>                 try {
>                                         String returnVal = 
> userManager.authenticateSshd(auth);
>                                         TokenId tokenId = new 
> TokenId(returnVal);
>                                         session.setAttribute(TOKEN_ID, 
> tokenId);
>                                 } catch (AuthenticationFailedException e) {
>                                         return false;
>                                 }
>
>                 return true;
>             }
>
> _____________________________
>
> Then in another class I try:
>
> public static boolean disconnectByTokenId(String tokenId) {
>                 List<AbstractSession> sessions = 
> server.getActiveSessions();
>                 for (AbstractSession session : sessions) {
>                         if (session != null
>                                         &&
> SshServer.getTokenId(session).getValue().equalsIgnoreCase(sessionTokenId)) {
>                                 session.close(true);
>                                 return true;
>                         }
>                 }
>
>                 return false;
>         }
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 9:30 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> Attributes are supposed to be used the following way
>
>       private static final AttributeKey<MyValue> MY_KEY = new 
> AttributeKey<MyValue>();
>
>       public static MyValue getMyValue(Session s) {
>         return s.getAttribute(MY_KEY);
>       }
>
>       private void setMyValue(Session s, MyValue value) {
>         s.setAttribute(MY_KEY, value);
>       }
>
>
> On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari 
> <Omari.Wright@solers.com
> >wrote:
>
> > Also, does that AttributeKey that I set have to be its own data type?
> >
> > -----Original Message-----
> > From: Guillaume Nodet [mailto:gnodet@gmail.com]
> > Sent: Friday, July 13, 2012 8:49 AM
> > To: users@mina.apache.org
> > Subject: Re: [Apache SSHD] Question about authentication
> >
> > The UserAuth interface you'll have to implement is given the 
> > ServerSession as a parameter and you can use get/setAttributes() to 
> > associate your id with the ssh session.
> > When you want to kick users, you can enumerate the sessions using
> > sshServer.getActiveSessions() and check what you need there, 
> > eventually calling close() on the sessions.
> >
> > On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari 
> > <Omari.Wright@solers.com
> > >wrote:
> >
> > > I have OpenAM which I plan to use to handle user authentication 
> > > again an Active Directory server. I plan to make a call during the 
> > > SSHD authenticate method passing along username/password. The 
> > > returned value of this call is a token id if it is successful and 
> > > null otherwise. I then want to associate this value with the 
> > > session as a type of session id. Is this possible? If so, how can 
> > > I go about doing
> > this?
> > >
> > > The token id would basically be an added property on the session.
> > > The reason I want this functionality is that I then want to be 
> > > able to kick users based off the token id passed to the disconnect 
> > > method. The reason for this is a need to have OpenAM manage user
> disconnects.
> > >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > FuseSource, Integration everywhere
> > http://fusesource.com
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: [Apache SSHD] Question about authentication

Posted by Guillaume Nodet <gn...@gmail.com>.
Looks good at a first glance.  What's the problem ?

On Fri, Jul 20, 2012 at 7:26 PM, Wright, Omari <Om...@solers.com>wrote:

> I'm still having problems accessing an attribute in the list of managed
> sessions.
>
> public static final AttributeKey<TokenId> TOKEN_ID = new
> AttributeKey<TokenId>();
>
> public boolean authenticate(String username, String password,
> ServerSession session) {
>                 PdaUserManager userManager = (PdaUserManager)
> session.getServerFactoryManager().getUserManagerFactory().createUserManager();
>                 Authentication auth = new
> UsernamePasswordAuthentication(username, password);
>
>                 try {
>                                         String returnVal =
> userManager.authenticateSshd(auth);
>                                         TokenId tokenId = new
> TokenId(returnVal);
>                                         session.setAttribute(TOKEN_ID,
> tokenId);
>                                 } catch (AuthenticationFailedException e) {
>                                         return false;
>                                 }
>
>                 return true;
>             }
>
> _____________________________
>
> Then in another class I try:
>
> public static boolean disconnectByTokenId(String tokenId) {
>                 List<AbstractSession> sessions =
> server.getActiveSessions();
>                 for (AbstractSession session : sessions) {
>                         if (session != null
>                                         &&
> SshServer.getTokenId(session).getValue().equalsIgnoreCase(sessionTokenId)) {
>                                 session.close(true);
>                                 return true;
>                         }
>                 }
>
>                 return false;
>         }
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 9:30 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> Attributes are supposed to be used the following way
>
>       private static final AttributeKey<MyValue> MY_KEY = new
> AttributeKey<MyValue>();
>
>       public static MyValue getMyValue(Session s) {
>         return s.getAttribute(MY_KEY);
>       }
>
>       private void setMyValue(Session s, MyValue value) {
>         s.setAttribute(MY_KEY, value);
>       }
>
>
> On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari <Omari.Wright@solers.com
> >wrote:
>
> > Also, does that AttributeKey that I set have to be its own data type?
> >
> > -----Original Message-----
> > From: Guillaume Nodet [mailto:gnodet@gmail.com]
> > Sent: Friday, July 13, 2012 8:49 AM
> > To: users@mina.apache.org
> > Subject: Re: [Apache SSHD] Question about authentication
> >
> > The UserAuth interface you'll have to implement is given the
> > ServerSession as a parameter and you can use get/setAttributes() to
> > associate your id with the ssh session.
> > When you want to kick users, you can enumerate the sessions using
> > sshServer.getActiveSessions() and check what you need there,
> > eventually calling close() on the sessions.
> >
> > On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari
> > <Omari.Wright@solers.com
> > >wrote:
> >
> > > I have OpenAM which I plan to use to handle user authentication
> > > again an Active Directory server. I plan to make a call during the
> > > SSHD authenticate method passing along username/password. The
> > > returned value of this call is a token id if it is successful and
> > > null otherwise. I then want to associate this value with the session
> > > as a type of session id. Is this possible? If so, how can I go about
> > > doing
> > this?
> > >
> > > The token id would basically be an added property on the session.
> > > The reason I want this functionality is that I then want to be able
> > > to kick users based off the token id passed to the disconnect
> > > method. The reason for this is a need to have OpenAM manage user
> disconnects.
> > >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> > ------------------------
> > FuseSource, Integration everywhere
> > http://fusesource.com
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

RE: [Apache SSHD] Question about authentication

Posted by "Wright, Omari" <Om...@solers.com>.
I'm still having problems accessing an attribute in the list of managed sessions.

public static final AttributeKey<TokenId> TOKEN_ID = new AttributeKey<TokenId>();

public boolean authenticate(String username, String password, ServerSession session) {
            	PdaUserManager userManager = (PdaUserManager) session.getServerFactoryManager().getUserManagerFactory().createUserManager();
            	Authentication auth = new UsernamePasswordAuthentication(username, password);
            	
            	try {
					String returnVal = userManager.authenticateSshd(auth);
					TokenId tokenId = new TokenId(returnVal);
					session.setAttribute(TOKEN_ID, tokenId);
				} catch (AuthenticationFailedException e) {
					return false;
				}
            	
            	return true;
            }

_____________________________

Then in another class I try:

public static boolean disconnectByTokenId(String tokenId) {
		List<AbstractSession> sessions = server.getActiveSessions();
		for (AbstractSession session : sessions) {
			if (session != null
					&& SshServer.getTokenId(session).getValue().equalsIgnoreCase(sessionTokenId)) {
				session.close(true);
				return true;
			}
		}

		return false;
	}


-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Friday, July 13, 2012 9:30 AM
To: users@mina.apache.org
Subject: Re: [Apache SSHD] Question about authentication

Attributes are supposed to be used the following way

      private static final AttributeKey<MyValue> MY_KEY = new AttributeKey<MyValue>();

      public static MyValue getMyValue(Session s) {
        return s.getAttribute(MY_KEY);
      }

      private void setMyValue(Session s, MyValue value) {
        s.setAttribute(MY_KEY, value);
      }


On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari <Om...@solers.com>wrote:

> Also, does that AttributeKey that I set have to be its own data type?
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 8:49 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> The UserAuth interface you'll have to implement is given the 
> ServerSession as a parameter and you can use get/setAttributes() to 
> associate your id with the ssh session.
> When you want to kick users, you can enumerate the sessions using
> sshServer.getActiveSessions() and check what you need there, 
> eventually calling close() on the sessions.
>
> On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari 
> <Omari.Wright@solers.com
> >wrote:
>
> > I have OpenAM which I plan to use to handle user authentication 
> > again an Active Directory server. I plan to make a call during the 
> > SSHD authenticate method passing along username/password. The 
> > returned value of this call is a token id if it is successful and 
> > null otherwise. I then want to associate this value with the session 
> > as a type of session id. Is this possible? If so, how can I go about 
> > doing
> this?
> >
> > The token id would basically be an added property on the session. 
> > The reason I want this functionality is that I then want to be able 
> > to kick users based off the token id passed to the disconnect 
> > method. The reason for this is a need to have OpenAM manage user disconnects.
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: [Apache SSHD] Question about authentication

Posted by Guillaume Nodet <gn...@gmail.com>.
Attributes are supposed to be used the following way

      private static final AttributeKey<MyValue> MY_KEY = new
AttributeKey<MyValue>();

      public static MyValue getMyValue(Session s) {
        return s.getAttribute(MY_KEY);
      }

      private void setMyValue(Session s, MyValue value) {
        s.setAttribute(MY_KEY, value);
      }


On Fri, Jul 13, 2012 at 3:15 PM, Wright, Omari <Om...@solers.com>wrote:

> Also, does that AttributeKey that I set have to be its own data type?
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Friday, July 13, 2012 8:49 AM
> To: users@mina.apache.org
> Subject: Re: [Apache SSHD] Question about authentication
>
> The UserAuth interface you'll have to implement is given the ServerSession
> as a parameter and you can use get/setAttributes() to associate your id
> with the ssh session.
> When you want to kick users, you can enumerate the sessions using
> sshServer.getActiveSessions() and check what you need there, eventually
> calling close() on the sessions.
>
> On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari <Omari.Wright@solers.com
> >wrote:
>
> > I have OpenAM which I plan to use to handle user authentication again
> > an Active Directory server. I plan to make a call during the SSHD
> > authenticate method passing along username/password. The returned
> > value of this call is a token id if it is successful and null
> > otherwise. I then want to associate this value with the session as a
> > type of session id. Is this possible? If so, how can I go about doing
> this?
> >
> > The token id would basically be an added property on the session. The
> > reason I want this functionality is that I then want to be able to
> > kick users based off the token id passed to the disconnect method. The
> > reason for this is a need to have OpenAM manage user disconnects.
> >
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

RE: [Apache SSHD] Question about authentication

Posted by "Wright, Omari" <Om...@solers.com>.
Also, does that AttributeKey that I set have to be its own data type?

-----Original Message-----
From: Guillaume Nodet [mailto:gnodet@gmail.com] 
Sent: Friday, July 13, 2012 8:49 AM
To: users@mina.apache.org
Subject: Re: [Apache SSHD] Question about authentication

The UserAuth interface you'll have to implement is given the ServerSession as a parameter and you can use get/setAttributes() to associate your id with the ssh session.
When you want to kick users, you can enumerate the sessions using
sshServer.getActiveSessions() and check what you need there, eventually calling close() on the sessions.

On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari <Om...@solers.com>wrote:

> I have OpenAM which I plan to use to handle user authentication again 
> an Active Directory server. I plan to make a call during the SSHD 
> authenticate method passing along username/password. The returned 
> value of this call is a token id if it is successful and null 
> otherwise. I then want to associate this value with the session as a 
> type of session id. Is this possible? If so, how can I go about doing this?
>
> The token id would basically be an added property on the session. The 
> reason I want this functionality is that I then want to be able to 
> kick users based off the token id passed to the disconnect method. The 
> reason for this is a need to have OpenAM manage user disconnects.
>



--
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: [Apache SSHD] Question about authentication

Posted by Guillaume Nodet <gn...@gmail.com>.
The UserAuth interface you'll have to implement is given the ServerSession
as a parameter and you can use get/setAttributes() to associate your id
with the ssh session.
When you want to kick users, you can enumerate the sessions using
sshServer.getActiveSessions() and check what you need there, eventually
calling close() on the sessions.

On Fri, Jul 13, 2012 at 2:41 PM, Wright, Omari <Om...@solers.com>wrote:

> I have OpenAM which I plan to use to handle user authentication again an
> Active Directory server. I plan to make a call during the SSHD authenticate
> method passing along username/password. The returned value of this call is
> a token id if it is successful and null otherwise. I then want to associate
> this value with the session as a type of session id. Is this possible? If
> so, how can I go about doing this?
>
> The token id would basically be an added property on the session. The
> reason I want this functionality is that I then want to be able to kick
> users based off the token id passed to the disconnect method. The reason
> for this is a need to have OpenAM manage user disconnects.
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com