Red Hat NETSCAPE ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Guide de l'utilisateur Page 312

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 332
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 311
Appendix A: Samples of User Program Descriptions
A-14
Displaying the User Validity Period
This sample program assumes the environment setup below. Change the setup according to the actual
environment used.
The public directory for creation of the repository is "ou=interstage,o=fujitsu,dc=com".
The storage location of user information is "ou=User,ou=interstage,o=fujitsu,dc=com".
RDN of user information is expressed by "cn".
The name of the user whose validity period is to be displayed is specified for "user" in
java.lang.String.
The result of common pre-processing is used as the value of "ctx".
Description of User Program
Example
Pre-processing
:
String [] ret = new String[2];
String [] retAttributes = { "ssoNotBefore", "ssoNotAfter" };
SearchControls sc = new SearchControls();
sc.setSearchScope(SearchControls.OBJECT_SCOPE);
sc.setReturningAttributes(retAttributes);
sc.setCountLimit(1);
sc.setTimeLimit(5 * 1000); // 5 seconds
String filter = "(cn=" + user + ")";
String dn = "cn=" + user + ",ou=User,ou=interstage,o=fujitsu,dc=com";
NamingEnumeration ne = ctx.search(dn, filter, sc);
ret[0] = ret[1] = null;
while(ne.hasMore()) {
SearchResult sr = (SearchResult)ne.next();
Attributes attrs = sr.getAttributes();
if(attrs != null) {
Attribute ba = attrs.get("ssoNotBefore");
if(ba != null) {
ret[0] = (String)ba.get();
}
Attribute aa = attrs.get("ssoNotAfter");
if(aa != null) {
ret[1] = (String)aa.get();
}
break;
}
Vue de la page 311
1 2 ... 307 308 309 310 311 312 313 314 315 316 317 ... 331 332

Commentaires sur ces manuels

Pas de commentaire