Created
July 25, 2018 12:28
-
-
Save aldaris/76f8eb9800b60e9fad911b41ad07b04c to your computer and use it in GitHub Desktop.
Export all service schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page language="java" import="java.security.AccessController, | |
java.io.FileWriter, | |
com.sun.identity.security.AdminTokenAction, | |
com.iplanet.sso.SSOToken, | |
com.sun.identity.sm.ServiceManager, | |
com.sun.identity.sm.ServiceSchemaManager, | |
org.apache.commons.io.IOUtils" | |
%> | |
<html> | |
<head> | |
<title>OpenAM</title> | |
</head> | |
<body> | |
<% | |
// Get valid SSOToken | |
SSOToken token = AccessController.doPrivileged(AdminTokenAction.getInstance()); | |
try { | |
for (String serviceName : new ServiceManager(token).getServiceNames()) { | |
ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, token); | |
try (FileWriter fw = new FileWriter("/Users/aldaris/openam/config/xml/" + serviceName + ".xml")) { | |
IOUtils.copy(ssm.getSchema(), fw); | |
} | |
} | |
} catch (Exception ex) { | |
out.println(ex); | |
} | |
%> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment