JAAS with user registry - Websphere

This is a discussion on JAAS with user registry - Websphere ; Hi, I am using JAAS in my project and i want your help for this. I want to authenticate and authorize username and password using JAAS. Here i am using standard custom registry for storing username and passwords. This registry ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: JAAS with user registry

  1. JAAS with user registry

    Hi,

    I am using JAAS in my project and i want your help for this. I want to authenticate and authorize username and password using JAAS. Here i am using standard custom registry for storing username and passwords. This registry consists of users.prop,group.prop files, FileRegistrySample.java class, RegExpressionSample.class and VersionInfo.xml. These files are written according to IBM specification. How can i authenticate and authorize username and passwords from my JAAS program with standard custom registry. Please help me, i am trying to find solution from 2 days where i could not get fine solution. Some suggested to use custom loginmodule but i could not understand how to use custom login module to call custom registry. I should use these classes for my project. Please find the attached required files.



    This is part of JAAS class:



    Hashtable env = new Hashtable();

    env.put(Context.INITIAL_CONTEXT_FACTORY,

    "com.ibm.websphere.naming.WsnInitialContextFactory");

    env.put(Context.PROVIDER_URL,

    "corbaloc:iiop:localhost:2810");

    final Context initialContext = new InitialContext(env);

    initialContext.lookup("");


    String username = "user1";

    String password = "user1";

    try{

    loginContext = new LoginContext("WSLogin", new WSCallbackHandlerImplusername,password));

    }catch(LoginException le) {

    System.err.println("LoginContext cannot be created. "+ le.getMessage());

    System.exit(-1);

    } catch(SecurityException se) {

    System.err.println("LoginContext cannot be created. "+ se.getMessage());

    }


    System.out.println("Trying to Login Now");



    if (loginContext!=null) {

    try{

    loginContext.login();

    }catch(LoginException le) {

    System.out.println("Authentication failed. " + le.getMessage());

    System.exit(-1);

    }



    }


    }

  2. Re: JAAS with user registry

    On 25 Jul, 04:54, potti.nareshku...@gmail.com wrote:
    > Hi,
    >
    > * I am using JAAS in my project and i want your help for this. I want to authenticate and authorize username and password using JAAS. Here i am using standard custom registry for storing username and passwords. This registry consists of users.prop,group.prop files, FileRegistrySample.java class,RegExpressionSample.class and VersionInfo.xml. These files are written according to IBM specification. How can i authenticate and authorize username and passwords from my JAAS program with standard custom registry. Please help me, i am trying to find solution from 2 days where i could not get fine solution. Some suggested to use custom loginmodule but i could not understand how to use custom login module to call custom registry. I should use these classes for my project. Please find the attached required files.
    >
    > This is part of JAAS class:
    >
    > * * * * * * * * * * * * Hashtable env = new Hashtable();
    >
    > * * * * * * * * * * * * env.put(Context.INITIAL_CONTEXT_FACTORY,
    >
    > * * * * * * * * * * * * "com.ibm.websphere.naming..WsnInitialContextFactory");
    >
    > * * * * * * * * * * * * env.put(Context.PROVIDER_URL,
    >
    > * * * * * * * * * * * * "corbaloc:iiop:localhost:2810");
    >
    > * * * * * * * * * * * * final Context initialContext = new InitialContext(env);
    >
    > * * * * * * * * * * * * initialContext.lookup("");
    >
    > * * * * * * * * * * * * String username = "user1";
    >
    > * * * * * * * * * * * * String password = "user1"; * * * * * * * * * *
    >
    > * * * * * * * * * * * * try{
    >
    > * * * * * * * * * * * * * * * * loginContext = new LoginContext("WSLogin", new WSCallbackHandlerImplusername,password));
    >
    > * * * * * * * * * * * * }catch(LoginException le){
    >
    > * * * * * * * * * * * * * * * * System.err.println("LoginContext cannot be created. "+ le.getMessage());
    >
    > * * * * * * * * * * * * * * * * System.exit(-1);
    >
    > * * * * * * * * * * * * } catch(SecurityExceptionse) {
    >
    > * * * * * * * * * * * * * * * * System.err.println("LoginContext cannot be created. "+ se.getMessage());
    >
    > * * * * * * * * * * * * }
    >
    > * * * * * * * * * * * * System.out.println("Trying to Login Now");
    >
    > * * * * * * * * * * * * if (loginContext!=null){
    >
    > * * * * * * * * * * * * * * * * try{
    >
    > * * * * * * * * * * * * * * * * * * * * loginContext.login();
    >
    > * * * * * * * * * * * * * * * * }catch(LoginException le) {
    >
    > * * * * * * * * * * * * * * * * * * * * System.out.println("Authentication failed. " + le.getMessage());
    >
    > * * * * * * * * * * * * * * * * * * * * System.exit(-1);
    >
    > * * * * * * * * * * * * * * * * }
    >
    > * * * * * * * * * * * * }
    >
    > }


    I've had lots of trouble with my custom login modules as well so your
    not alone. I started with someone elses implementation of custom login
    modules and just edited it to get what i needed.

    Documentation Here! a>
    Files Here

    I used these and edited them so they no longer check a password from a
    db but I've managed to lock myself out of WAS 2x already so becareful.
    Still not managed to get a solution but hopefully this will help you

  3. Re: JAAS with user registry

    potti.nareshkumar@gmail.com wrote:
    > Hi,
    >
    > I am using JAAS in my project and i want your help for this. I want
    > to authenticate and authorize username and password using JAAS. Here
    > i am using standard custom registry for storing username and
    > passwords. This registry consists of users.prop,group.prop files,
    > FileRegistrySample.java class, RegExpressionSample.class and
    > VersionInfo.xml. These files are written according to IBM
    > specification. How can i authenticate and authorize username and
    > passwords from my JAAS program with standard custom registry. Please
    > help me, i am trying to find solution from 2 days where i could not
    > get fine solution. Some suggested to use custom loginmodule but i
    > could not understand how to use custom login module to call custom
    > registry. I should use these classes for my project. Please find the
    > attached required files.
    >
    >
    >



    A few points.

    - there is no such thing as a "standard" custom registry.

    - the sample registry that you describe is not recommended for
    production use. It's there for simple testing only.

    - if you are using a WAS compliant custom registry, you don't need a
    JAAS login module, you just configure WAS to use your CUR. You do,
    however, need to turn on WAS security.

  4. Re: JAAS with user registry

    On Jul 25, 11:12*am, Paul Ilechko wrote:
    > potti.nareshku...@gmail.com wrote:
    > > Hi,

    >
    > > I am using JAAS in my project and i want your help for this. I want
    > > to authenticate and authorize username and password using JAAS. Here
    > > i am using standard custom registry for storing username and
    > > passwords. This registry consists of users.prop,group.prop files,
    > > FileRegistrySample.java class, RegExpressionSample.class and
    > > VersionInfo.xml. These files are written according to IBM
    > > specification. How can i authenticate and authorize username and
    > > passwords from my JAAS program with standard custom registry. Please
    > > help me, i am trying to find solution from 2 days where i could not
    > > get fine solution. Some suggested to use custom loginmodule but i
    > > could not understand how to use custom login module to call custom
    > > registry. I should use these classes for my project. Please find the
    > > attached required files.

    >
    > A few points.
    >
    > - there is no such thing as a "standard" custom registry.
    >
    > - the sample registry that you describe is not recommended for
    > production use. It's there for simple testing only.
    >
    > - if you are using a WAS compliant custom registry, you don't need a
    > JAAS login module, you just configure WAS to use your CUR. You do,
    > however, need to turn on WAS security.- Hide quoted text -
    >
    > - Show quoted text -


    Hi,
    Its for purposes for testing only. Its standalone custom registry
    consists of user.props and group.props file and java code needed for
    authetication. My java client is sending username and password to
    loginmodule and from that login module im trying to autheticate with
    custom registry, but its not authenticating with props file.
    How to autheticate with custom registry.

+ Reply to Thread