API To Query CredentialStore using jps-config.xml


package com.jps;
import java.util.Iterator;
import java.util.Set;

import oracle.security.jps.JpsContext;
import oracle.security.jps.JpsContextFactory;
import oracle.security.jps.service.credstore.CredentialMap;
import oracle.security.jps.service.credstore.CredentialStore;
public class QueryCredentialStore {
 public static void main(String[] args) throws Exception {
  JpsContextFactory ctxFactory = JpsContextFactory.getContextFactory();
  JpsContext ctx = ctxFactory.getContext();

  CredentialStore store = ctx.getServiceInstance(CredentialStore.class);
  
  Set<String> maps = store.getMapNames();
  Iterator<String> it = maps.iterator();
  
  while (it.hasNext()) {
   String mapName = it.next();
   System.out.println(mapName);
   
   CredentialMap cm = store.getCredentialMap(mapName);
   Set<String> s = cm.keySet();
   
   Iterator<String> it1 = s.iterator();
   while (it1.hasNext()) {
    System.out.println(it1.next());
   }
  }
 }
}

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts