Determining password expiry using java + ADLDS

If authentication fails, I have to determine that password has expired.
I can not use 'pwdLastSet' attribute because password policy depends on domain server.
I have to check the attribute 'msDS-UserPasswordExpired' whether it is true or false.
But I am not able to do it since it is constructed attribute.
I have seen it is done in .NET using 'RefreshCache' method.
How it can be done in Java?
Please note this is a repetition of an earlier thread as it was not answered

You may alter your profile beforehand:
ALTER PROFILE XYZ LIMIT PASSWORD_REUSE_MAX UNLIMITED

Similar Messages

  • Setting password expiry using the SDK

    Without using the iDS console, meaning just by using the SDK, could I set the period for password expiry?
    Since the userPassword is a multi-value attribute, how can I differentiate between which is the password for signing-onto the server and which are passwords for other applications?

    If you mean to configure the password policy using the SDK, a Modify operation for the base object "cn=config" and replacing the value of "PasswordMaxAge" attribute will work.
    If you intend to set a specific expiration time for a specific user, you should not do this and let the server set the expiration time based on the configured password ploicy.
    For more information on the password policy configuration, you can refer to the Administration Guide.
    Also, although userPassword is multivalued, the pasword policy as currently defined in the Directory server suppose that the userPassword attribute contains only 1 value. If the password contains more than 1 value, the result of the password policy is undefined.
    And there is no way to differentiate between passwords.
    Regards,
    Ludovic.

  • LDAP password replace using java script

    Hi all!
    I wrote a perl script to generate random password. It works great.
    I have an existing java class which currently changes user password to
    match user id in LDAP database.
    I am trying to call my perl script from within java and parse the output
    of the perl script to string value.
    What would be the best way to approach this problem. I am new to java. I
    know shell and perl programming and simple command substitution (back
    quotes) would do the trick there. I know there is no such thing in java.
    Your help is greatly appreciated.
    Thank You.

    It's probably because your id used in the Javascript to find the h:inputSecret tag is wrong. JSF appends parent id's in front of the children id's (and separates them with a colon). Check your HTML source and see.
    The id you should be using is something like: "createUserForm:passwd"
    Hope this helps,
    CowKing

  • Determining RAM size using Java

    Hi,
    Apologies in advance if this seems to be an oft-repeated topic. I just wanted to confirm if I am missing something or not.
    I am trying to find the total amount of RAM available to the OS and am using the java management API to do it (I am using JDK 1.6 update 7):
    import java.lang.management.ManagementFactory;
    import com.sun.management.OperatingSystemMXBean;
    public class Mem{
         public static void main(String[] args){
              OperatingSystemMXBean osb = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
              System.out.println(osb.getTotalPhysicalMemorySize());
    }This code seems to return the correct value of total RAM on Linux. On Windows, however, I get some random value. I believe it could be because of this bug: [http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=132bbb6b3cbd535627637e96a07c?bug_id=6628662|http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=132bbb6b3cbd535627637e96a07c?bug_id=6628662] So I doubt I can use this approach on Windows.
    An alternate way would be to call OS specific commands from within Java, parse the results I receive and use them. I would like to keep that as the last resort. I want to avoid JNI too.
    My question is, is there any other way to retrieve the information? Are there lightweight third-party tools which can be integrated into my java code?
    Any input will be greatly appreciated.
    Thank you!

    I need this info for a "setup" program which allows the end-user to choose how much max heap memory they want to allocate for their application. I don't want to display values which are beyond what is physically available in the system.Ok. IMHO this is not a great use of your time. First of all, total RAM is not nearly as important as total RAM - memory manager - OS. Second of all, system memory is more than just RAM. Virtual memory allows you to have much more in memory than your RAM.
    IMHO you should leave this to the user to performance tune their own machine.

  • Password expiry redux

    After an exhaustive RTFM session reading the docs on SGD 4.4; Kerberos, etc. and bombing out with password expiry time and time again I was told, in this forum, that there is an "unpublished bug" in the jre that ships with SGD 4.4, breaking AD password expiry. No fix or patch was mentioned.
    Before wasting more time, could anyone tell me if there are any other "known issues" with AD password expiry using SGD 4.31? (BTW, it isn't working either).
    regards,
    -damon

    this is correct, there is a bug in Java 1.6 that ships with both 4.31 and 4.40. The fix is in 1.6.0 update 4. Please check http://java.sun.com in the next week or so for details on when the update will be released. Please open a case with Sun Support so that the instructions for upgrading the existing JVM can be provided.

  • Unable to raise password expiry warning exception in OID using JAVA API

    Hi,
    We are maintaing the user information for our application in OID(9.2). During logon, it is required that a warning is given to the user according to the value set in "Password Expiration Warning" parameter.
    A pl/sql program (using DBMS_LDAP/DBMS_LDAP_UTL packages) written to test password expiry raises the PWD_EXPIRE_WARN exception as expected. However we are unable to simulate the same using the JAVA APIs.
    We did try some thing like the following:
    public class SampleExpire {
    public static void main(String argv[])
    throws NamingException {
    // Create InitialDirContext
    InitialDirContext ctx = ConnectionUtil.getDefaultDirCtx( "TCS-UUODC4",
    "4032",
    "cn=orcladmin",
    "welc0me" );
    System.out.println("Hello");
    // Create User Objects
    User myuser = null,
    try {
    // Create User using a subscriber DN and the User DN
    myuser = new User ( ctx,
    Util.IDTYPE_DN,
    "uid=C100013, ou=People, o=UUSD",
    Util.IDTYPE_DN,
    "ou=People, o=UUSD",
    false );
    catch ( UtilException e ) {
    * Exception encountered in User object constructor
    System.out.println("User creation failed");
    // Authenticate User
    try {
    myuser.authenticateUser(ctx,User.CREDTYPE_PASSWD,"Z100013");
    catch ( UtilException e ) {
    * Authenticate fails
    System.out.println("Authentication failed");
    } // End of SampleExpire.java
    The authenticate user does not raise any exception.
    Am I missing something ?
    Regards -
    Adhiraj

    Hi,
    did you manage to solve this problem? Please let me know

  • Saving the password of a user in active directory using java

    Hello, i am trying to use java to build a class that creates a user in Active directory 2012.But the problem is that when the user is created the password is not being saved.
    Can anybody help on this knowing that i tried to save in the fields userPassword and unicodePwd.
    Thanks.

    DirContext ctx = new InitialDirContext(pr);
              BasicAttributes entry = new BasicAttributes(true);
              String entryDN = "cn=CharbelHad,ou=test users,dc=test,dc=dev";
              Attribute cn = new BasicAttribute("cn", "ChHad");
              Attribute street = (new BasicAttribute("streetAddress", "Ach"));
              Attribute loginPreW2k = (new BasicAttribute("sAMAccountName", "[email protected]"));
              Attribute login = (new BasicAttribute("userPrincipalName", "[email protected]"));
              Attribute sn = (new BasicAttribute("sn", "Chl"));
              Attribute pwd = new BasicAttribute("unicodePwd", "\"Ch@341\"".getBytes("UTF-8"));
    Attribute userAccountControl = new BasicAttribute("userAccountControl", "512");
              Attribute oc = new BasicAttribute("objectClass");
              oc.add("top");
              oc.add("person");
              oc.add("organizationalPerson");
              oc.add("user");
              // build the entry
              entry.put(cn);
              entry.put(street);
              entry.put(sn);
              entry.put(userAccountControl);
              entry.put(pwd);
              entry.put(login);
              entry.put(loginPreW2k);
              entry.put(oc);
              ctx.createSubcontext(entryDN, entry);

  • How to get the password of a password protected Excel Sheet using java/jxl

    Hi ,
    how to get the password of a password protected Excel Sheet using java / jxl program.
    plz any one help me .
    Ramesh P
    [email protected]

    If they've implemented the password system correctly there probably isn't a way of getting the password at all.

  • Password protected Excel file generation using Java

    Hi,
    I want to create password protected excel file using Java. So when you manually open this file it should prompt for password.
    There are APIs but they are licensed and are for trial period. I want solution which is free.
    I need this solution urgently..
    :-)

    Swati.S wrote:
    Hi Administrator,
    Moderator. Administrators post with the Sun logo.
    I'm sorry I wasnt aware that we cannot have off forum communication. Can you please communicate how I can spread this message taht solution for this is available.If you like, you can post the code here or on [SDN Share|http://sdnshare.sun.com/]. Apart from that, there's no shortage of blog sites.

  • How to set Password protection in excel using java

    Dear all,
    I have no idea to write a java program that how to set password protection in excel. Please give me some solution using java tools. Thank a lot!
    Regards,
    kzyo

    Dear Bamkin ,
    I used your code and paste it in my program. The error is as the follow:
    Code:
         stmnt = c.createStatement();
                   String query = "select StudentNumber, Email, New_Email_Address from [Sheet1$] where Len(New_Email_Address) > 0";
                   System.out.println(query);
                   rs = stmnt.executeQuery(query);
                   stmnt.executeUpdate("SET PASSWORD=PASSWORD('Test')");
    Error:
    (Remark: Invalid SQL statement)
    java.sql.SQLException: [Microsoft][ODBC Excel Driver] �����I SQL ���q���G�a����'DELETE'�A'INSERT'�A'PROCEDURE'�A'SELECT' �� 'UPDATE' �B
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
         at hk.gov.edb.util.ExcelHandle.updateNewEmail(ExcelHandle.java:414)
         at hk.gov.edb.core.AppMain.doUpdate(AppMain.java:369)
         at hk.gov.edb.core.AppMain$7.construct(AppMain.java:584)
         at hk.gov.edb.util.SwingWorker$2.run(SwingWorker.java:127)
         at java.lang.Thread.run(Thread.java:595)

  • ***How to use Java to change user password in *mdw file?

    Hi,
    Is it possible to use java to change user's password in the MS Access workgroup file(*mdw)? I have been searching for this topic for a long time, but no discoveries yet. Anyone has any idea?
    Sincerely,
    nonameisname

    There is probably a windows API call that does it.
    Once you find it, you wrap it in C code and then use JNI to call it from Java.

  • How to determine the presence of adobe pdf reader using java/J2EE?

    Can someone share this with me. I need to determing how do we determine if adobe reader is installed on a user's machine or not - using java/J2EE.
    Any ideas?
    Thanks,
    Pratik.

    I am in the software, where can I find it?
    On Tue, Jan 27, 2015 at 9:59 AM, Sara.Forsberg <[email protected]>

  • How to dynamically configure JPA setting at runtime using java code?

    Hi,
    I am new to EJB 3.0 and JPA. I am trying to help my company to deploy the use of JPA in EJB3.0. Currently, i am trying out with OpenJPA in IBM Webshpere Application Server 7.0. We have four different WAS servers running for testing, system integration testing, user testing and production respectively, and in each region, the configurations for data source, JDBC username and password, schema, etc are different. So i think i would need to configure the JPA setting during runtime using Java code that determines which is the environment. And apparently i am stuck with the limited knowledge i have.
    1) I understand that i could override the JDBC in the persistence xml by creating entity manager using entity manager factory. But is it possible that i do similar thing by using inejction of persistence context on entity manager to obtain a container managed entity manager?
    2) Alternatively, it is possible to create multiple persistence unit in the XML and inject different PU to the entity manager, am i right? But how to inject dynamically since @PersistenceContext(unitName="xxx") only accepts constant declaration.
    3) Is it possible that the JDBC username and password are read from properties file?
    Thanks for your help in advance!

    Hi
    Thanks for the reply.
    Are you saying that i have to configure the data source authentication to the backend DB2 using the JAAS-J2C? Correct me if i am mistaken. I guess i am unable to do so as the application server setup only contains one data source, and the server hosted a number of applications. Every applications has their own JDBC username and password supply to the data source (the ID supplied at the DB2 side will decide which resource can access) and thus, i have to supply the username and password at runtime. Talked to the server guy and seems that it is not feasible to have seperate datasource for each applications as considered to the volume of applications hosted inside the server.
    Any suggestion?

  • Update database logon in reports using java

    Please review the code below and let me know where did I go wrong! I am able to login to CMS and able to retrieve the list of reports. Now, I am trying to update the database credentials for a single report using java (My requirement is to update all 200 reports though!).
    This is the 100th time I go this error message: Failed to open the connection.report.lib.ReportSDKServerException: Failed to open the connection.
    I also wrote a sample java program which tries to connect to the sql server database with same login credentials - this works perfectly fine. But, if I use the same connection url, driver name and login credentials, this report fails to update for whatever reason. Please help me ASAP..Thanks!
    import com.crystaldecisions.sdk.exception.*;
    import com.crystaldecisions.sdk.framework.*;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.crystaldecisions.sdk.occa.managedreports.*;
    import com.crystaldecisions.sdk.occa.report.application.*;
    import com.crystaldecisions.sdk.occa.report.data.*;
    import com.crystaldecisions.sdk.occa.report.lib.*;
    import java.util.Iterator;
    class ChangeDataSource {
        public static void main(String args[]){
             String cms = "134.X.X.X:6400";
             String username = "Administrator";
             String password = "";
             String auth = "secEnterprise";
             IEnterpriseSession enterpriseSession = null;
             ISessionMgr sessionMgr = null;//CrystalEnterprise.getSessionMgr();   
             Exception failure = null;
             boolean loggedIn = true;
             ReportClientDocument clientDoc = null;
             if (enterpriseSession == null)
              try
                  sessionMgr = CrystalEnterprise.getSessionMgr();
                  enterpriseSession = sessionMgr.logon(username, password, cms, auth);
                  System.out.println("\nLOGIN SUCCESSFUL\n");
              catch (Exception error)
                  loggedIn = false;
                  failure = error;
              if (!loggedIn)
                   System.out.println("\nLOGIN FAILED\n");
              else
                  // Query for the sample report from the Enterprise CMS.
                  try {
                        IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
                        IInfoObjects infoObjects = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_INSTANCE=0 AND SI_PARENT_FOLDER=771");
                        System.out.println("\ninfoObjects size = "+infoObjects.getResultSize());
                        IReportAppFactory reportAppFactory = (IReportAppFactory)enterpriseSession.getService("RASReportFactory");
                        IInfoObject infoObject = (IInfoObject)infoObjects.get(0);      
                        clientDoc = new ReportClientDocument();
                        clientDoc = reportAppFactory.openDocument(infoObject,0, java.util.Locale.US);
                        System.out.println("Report "+ infoObject.getTitle() +" Opened");     
                        switch_tables(clientDoc.getDatabaseController());
                   }catch(ReportSDKException re){                    
                        re.printStackTrace();
                   }catch(SDKException re){
                        re.printStackTrace();
         private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
              //Declare the new connection properties that report's datasource will be switched to.
              //NOTE: These are specific to using JDBC against a particular MS SQL Server database.  Be sure to use the
              //DisplayConnectionInfo sample to determine what your own connection properties need to be set to.
              final String TABLE_NAME_QUALIFIER = "dbname.dbo.";
              final String DATABASE_NAME = "dbname";
              final String DBUSERNAME = "userid";
              final String DBPASSWORD = "pword";
              final String SERVERNAME = "134.X.X.X";
              final String CONNECTION_URL = "jdbc:sqlserver://134.X.X.X:1433;DatabaseName=dbname";
              final String DATABASE_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
              final String DATABASE_DLL = "crdb_jdbc.dll";
              //Obtain collection of tables from this database controller.
              Tables tables = databaseController.getDatabase().getTables();
              System.out.println("\nTables size = "+tables.size());
              //Set the datasource for all main report tables.
              for (int i = 0; i < tables.size(); i++) {
                   //ITable currTable = tables.getTable(i);     
                   ITable table = tables.getTable(i);
                   //Keep existing name and alias.
                   table.setName(table.getName());
                   table.setAlias(table.getAlias());
                   //System.out.println("Table Name = "+table.getName()+" Alias "+table.getAlias());
                   //Change properties that are different from the original datasource.
                   table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
                   System.out.println(table.getQualifiedName());
                   //Change connection information properties.
                   IConnectionInfo connectionInfo = null;
                   try{
                        connectionInfo = table.getConnectionInfo();
                        //System.out.println("conn info: "+connectionInfo);
                   }catch(Exception re) {
                        re.printStackTrace();
                   //Set new table connection property attributes.
                   PropertyBag propertyBag = new PropertyBag();
                   //Overwrite any existing properties with updated values.
                   propertyBag.put("Trusted_Connection", "false");
                   propertyBag.put("Connection URL", CONNECTION_URL);
                   propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
                   propertyBag.put("Server", SERVERNAME);
                   //propertyBag.put("Database Name", DATABASE_NAME);
                   propertyBag.put("Server Type", "JDBC (JNDI)");
                   //propertyBag.put("URI", null);
                   propertyBag.put("Use JDBC", "true");
                   propertyBag.put("Database DLL", DATABASE_DLL);
                   connectionInfo.setAttributes(propertyBag);
                   System.out.println("\n Properties SET\n");
                   //Set database username and password.
                   //NOTE: Even if these the username and password properties don't change when switching databases, the
                   //database password is *not* saved in the report and must be set at runtime if the database is secured. 
                   connectionInfo.setUserName(DBUSERNAME);
                   connectionInfo.setPassword(DBPASSWORD);
                   connectionInfo.setKind(ConnectionInfoKind.SQL);
                   table.setConnectionInfo(connectionInfo);
                   //Update old table in the report with the new table.
                   try {
                        databaseController.setTableLocation(table, tables.getTable(i));               
                        }catch(ReportSDKException re) {
                        re.printStackTrace();
                   System.out.println("\n All tables updated\n");

    I have exactly same error. I can confirm that CRJavaHelper.changeDataSourceReportClientDocument clientDoc,
                    String reportName, String tableName,
                    String username, String password, String connectionURL,
                    String driverName,String jndiName)
    has very slow performance.
    Obviously the line:
                        clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
    works very slow. I also have JDBC defined in report and also stored procedure, that returns recordset (cursor) in 0.48 sec.
    I am using CR Reports Server XI R2 and custom JAVA client program that renders report to pdf.
    Lines from java program:
    rpt = new ReportClientDocument();
    String report = "C:
    temp
    CrystalReport1.rpt";
    rpt.open(report, com.crystaldecisions.sdk.occa.report.application.OpenReportOptions._openAsReadOnly);
    CRJavaHelper.changeDataSource(rpt, "The specified item was not found.", "", "jdbc:oracle:thin:@oratest:1521:oratest","oracle.jdbc.driver.OracleDriver", "");
    CRJavaHelper.addDiscreteParameterValue(rpt, "", "P_INET_ID", id);
    rpt.refreshReportDocument();
    PDFExportFormatOptions pdfOptions = new PDFExportFormatOptions();
    ExportOptions exportOptions = new ExportOptions();
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    exportOptions.setFormatOptions(pdfOptions);
    InputStream is = rpt.getPrintOutputController().export(exportOptions);

  • How to link two user interfaces together through networking using java??

    Im doing an java assignmet...the entry system...
    I have to create two interfaces ..
    one is a interface which is a keypad and let user key in their password
    for accessing...
    another interface is receive the password and determine whether it is valid or not...
    Two interfaces is on different computer.....
    I have to link these interfaces together using java....
    PLS HELP!!!!!!

    It sounds like you should probabally use RMI.That is, remote method invocation...these guys are doing a more complicated version of what you want to do:
    http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20680356.html#8935218
    Be sure to check out Sun's RMI tutorial:
    http://java.sun.com/docs/books/tutorial/rmi/
    Happy coding! Sounds like a fun little project...I want to do some RMI sometime when I get a chance...

Maybe you are looking for

  • Aperture book copyright question!

    Hey...I was wondering if it would be allowed to make Aperture books and resell them....obviously if I do not own the copyright then I a cannot...but let's say I take a bunch of pics of my hometown and make a book and ask Apple for copies of this book

  • Excise Sales Gate Pass with Purchase Invoice details.

    Hi All,                While making a Excise Sales Invoice,we need to link it with the corresponding items Purchase Invoice details for Generate Excise Sales Gate Pass. How can it be done in SAP B1. Please guide me. Thanks in advance Rajesh

  • QT Pro registration fail

    I'm running QT Player Version 7.6.6 (free) and I want to use a Pro feature (Open Image Sequence) so I've purchased a registration key for QT Pro 7. When I go to 'Register' (Quicktime Player / Registration...) nothing happens - no window opens to prom

  • Changing CHECKBOX's check colour to red from usual BLACK.

    Hi All, I wanna change the checkbox check color to red from black. ...; There are some API's i found in the help like setStyle and symbolColor, but im not getting the exact way they need to be framed,. Can anyone explain me how i can change the black

  • Zeros in invalid dimension intersections

    Hi all, I'm perplexed with a case, when a method writes zeros to invalid intersections, and I can see them in a data grid. The method is like this: Sub Consolidate() If HS.Value.Member = "[Parent Total]"  Then Call Cons_1 End Sub Sub Cons_1() Set obj