Search in sources :

Example 1 with NAEUserModifyRequest

use of com.ingrian.security.nae.NAEUserModifyRequest in project CipherTrust_Application_Protection by thalescpl-io.

the class AdminRequestSample method modifyUserCustomAttrs.

private static void modifyUserCustomAttrs(NAEAdminRequestProcessor processor) {
    System.out.print("Enter user-name :");
    String userName = sc.next();
    CustomAttributes attrsToAdd = new CustomAttributes();
    List<String> attrsToDelete = new ArrayList<String>();
    System.out.print("Enter Number Of Attribute To Add/Modify :");
    int num = Integer.parseInt(sc.next());
    while (num-- > 0) {
        System.out.print("Enter Attribute Name To Add/Modify :");
        String attr = sc.next();
        System.out.print("Enter Attribute Value :");
        String attrValue = sc.next();
        attrsToAdd.addAttribute(attr, attrValue);
    }
    System.out.print("Enter Number Of Attributes To Delete :");
    num = Integer.parseInt(sc.next());
    while (num-- > 0) {
        System.out.print("Enter Attribute Name To Delete :");
        String attr = sc.next();
        attrsToDelete.add(attr);
    }
    NAEUserModifyRequest umr = new NAEUserModifyRequest.Builder().userName(userName).customAttrsToAdd(attrsToAdd).customAttrsToDelete(attrsToDelete).build();
    boolean success = processor.modifyUser(umr);
    if (success)
        System.out.println("User Custom attributes modified successfully");
    else
        System.out.println("Failure in user Custom attibute modification");
}
Also used : CustomAttributes(com.ingrian.security.nae.CustomAttributes) ArrayList(java.util.ArrayList) NAEUserModifyRequest(com.ingrian.security.nae.NAEUserModifyRequest)

Aggregations

CustomAttributes (com.ingrian.security.nae.CustomAttributes)1 NAEUserModifyRequest (com.ingrian.security.nae.NAEUserModifyRequest)1 ArrayList (java.util.ArrayList)1