You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by hosseinakbari <h_...@magfa.com> on 2008/12/02 11:43:54 UTC

Authentication for Repository

Hi,
How can I put username and password for accessing a repository

thanks
-- 
View this message in context: http://www.nabble.com/Authentication-for-Repository-tp20789768p20789768.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Authentication for Repository

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Dec 2, 2008 at 11:43 AM, hosseinakbari <h_...@magfa.com> wrote:
> How can I put username and password for accessing a repository

The Repository.login method takes an optional Credentials argument.
You can use a SimpleCredentials instance with the username and
password as this argument:

    import javax.jcr.*;

    Credentials credentials = new SimpleCredentials(
        "username", "password".toCharArray());
    Session session = repository.login(credentials);

BR,

Jukka Zitting