use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class FSAuthDomainsModelImpl method deleteAuthenticationDomain.
/**
* Deletes an authentication domain (circle of trust) within a given realm.
*
* @param realm name of realm where authentication domain exists.
* @param cotName name of the authentication domain.
* @throws AMConsoleException if authentication domain cannot be deleted.
*/
public void deleteAuthenticationDomain(String realm, String cotName) throws AMConsoleException {
String[] param = { realm, cotName };
logEvent("ATTEMPT_DELETE_AUTH_DOMAINS", param);
try {
CircleOfTrustManager manager = getCircleOfTrustManager();
manager.deleteCircleOfTrust(realm, cotName);
logEvent("SUCCEED_DELETE_AUTH_DOMAIN", param);
} catch (COTException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, cotName, strError };
logEvent("FEDERATION_EXCEPTION_DELETE_AUTH_DOMAIN", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class CreateCircleOfTrust method handleRequest.
/**
* Creates a circle of trust.
*
* @param rc Request Context.
* @throws CLIException if unable to process this request.
*/
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
realm = getStringOptionValue(FedCLIConstants.ARGUMENT_REALM, "/");
cot = getStringOptionValue(FedCLIConstants.ARGUMENT_COT);
prefix = getStringOptionValue(FedCLIConstants.ARGUMENT_PREFIX);
trustedProviders = (List) rc.getOption(FedCLIConstants.ARGUMENT_TRUSTED_PROVIDERS);
Set providers = new HashSet();
if (trustedProviders != null) {
providers.addAll(trustedProviders);
}
String[] params = { realm, cot, providers.toString(), prefix };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_CREATE_COT", params);
try {
CircleOfTrustDescriptor descriptor = ((prefix == null) || (prefix.trim().length() == 0)) ? new CircleOfTrustDescriptor(cot, realm, COTConstants.ACTIVE, "", null, null, null, null, providers) : new CircleOfTrustDescriptor(cot, realm, COTConstants.ACTIVE, "", prefix + "/idffreader", prefix + "/idffwriter", prefix + "/saml2reader", prefix + "/saml2writer", providers);
CircleOfTrustManager cotManager = new CircleOfTrustManager(ssoToken);
cotManager.createCircleOfTrust(realm, descriptor);
Object[] objs = { cot, realm };
getOutputWriter().printlnMessage(MessageFormat.format(getResourceString("create-circle-of-trust-succeeded"), objs));
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEEDED_CREATE_COT", params);
} catch (COTException e) {
debug.warning("CreateCircleOfTrust.handleRequest", e);
String[] args = { realm, cot, providers.toString(), prefix, e.getMessage() };
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_CREATE_COT", args);
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class DeleteCircleOfTrust method handleRequest.
/**
* Deletes a circle of trust.
*
* @param rc Request Context.
* @throws CLIException if unable to process this request.
*/
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
realm = getStringOptionValue(FedCLIConstants.ARGUMENT_REALM, "/");
cot = getStringOptionValue(FedCLIConstants.ARGUMENT_COT);
String[] params = { realm, cot };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_DELETE_COT", params);
try {
CircleOfTrustManager cotManager = new CircleOfTrustManager(ssoToken);
cotManager.deleteCircleOfTrust(realm, cot);
Object[] obj = { cot };
getOutputWriter().printlnMessage(MessageFormat.format(getResourceString("delete-circle-of-trust-succeeded"), obj));
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEEDED_DELETE_COT", params);
} catch (COTException e) {
debugWarning("DeleteCircleOfTrust.handleRequest", e);
String[] args = { realm, cot, e.getMessage() };
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_DELETE_COT", args);
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class AddCircleOfTrustMembers method handleRequest.
/**
* Adds member to a circle of trust.
*
* @param rc Request Context.
* @throws CLIException if unable to process this request.
*/
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
realm = getStringOptionValue(FedCLIConstants.ARGUMENT_REALM, "/");
cot = getStringOptionValue(FedCLIConstants.ARGUMENT_COT);
spec = FederationManager.getIDFFSubCommandSpecification(rc);
entityID = getStringOptionValue(FedCLIConstants.ARGUMENT_ENTITY_ID);
String[] params = { realm, entityID, cot, spec };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_ADD_COT_MEMBER", params);
try {
CircleOfTrustManager cotManager = new CircleOfTrustManager(ssoToken);
cotManager.addCircleOfTrustMember(realm, cot, spec, entityID);
Object[] objs = { spec, cot, entityID, realm };
getOutputWriter().printlnMessage(MessageFormat.format(getResourceString("add-circle-of-trust-member-succeeded"), objs));
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEEDED_ADD_COT_MEMBER", params);
} catch (COTException e) {
debugWarning("AddCircleOfTrustMembers.handleRequest", e);
if (e instanceof L10NMessage) {
String[] args = { realm, entityID, cot, spec, ((L10NMessage) e).getL10NMessage(getCommandManager().getLocale()) };
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_COT_MEMBER", args);
throw new CLIException(((L10NMessage) e).getL10NMessage(getCommandManager().getLocale()), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} else {
String[] args = { realm, entityID, cot, spec, e.getMessage() };
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_COT_MEMBER", args);
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
}
use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.
the class RemoveCircleOfTrustMembers method handleRequest.
/**
* Removes member from a circle of trust.
*
* @param rc Request Context.
* @throws CLIException if unable to process this request.
*/
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
realm = getStringOptionValue(FedCLIConstants.ARGUMENT_REALM, "/");
cot = getStringOptionValue(FedCLIConstants.ARGUMENT_COT);
entityID = getStringOptionValue(FedCLIConstants.ARGUMENT_ENTITY_ID);
spec = FederationManager.getIDFFSubCommandSpecification(rc);
String[] params = { realm, cot, entityID, spec };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_REMOVE_COT_MEMBER", params);
try {
CircleOfTrustManager cotManager = new CircleOfTrustManager(ssoToken);
cotManager.removeCircleOfTrustMember(realm, cot, spec, entityID);
Object[] objs = { cot, entityID, realm };
getOutputWriter().printlnMessage(MessageFormat.format(getResourceString("remove-circle-of-trust-member-succeeded"), objs));
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEEDED_REMOVE_COT_MEMBER", params);
} catch (COTException e) {
debugWarning("RemoveCircleOfTrustMembers.handleRequest", e);
String[] args = { realm, cot, entityID, spec, e.getMessage() };
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_REMOVE_COT_MEMBER", args);
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations