/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS. All rights reserved.
*/
/*
* Portions Copyrighted 2015 Nomura Research Institute, Ltd.
*/
/**
* Base class ViewBean invoked to edit an existing STS instance. The AMServiceProfileViewBeanBase class is not extended here
* as for the RestSTSAddViewBean because the generic propertySheet constitution logic in the AMServiceProfileViewBeanBase
* class does not work for SubConfig state, which is where STS instance state is stored.
*/
private static final String REST_PROPERTY_MODEL_DEFINITION_FILE = "com/sun/identity/console/propertyRestSecurityTokenService.xml";
private static final String SOAP_PROPERTY_MODEL_DEFINITION_FILE = "com/sun/identity/console/propertySoapSecurityTokenService.xml";
protected boolean submitCycle;
super(viewBeanName);
} else {
}
}
protected void initialize() {
super.initialize();
}
protected void registerChildren() {
super.registerChildren();
ptModel.registerChildren(this);
if (propertySheetModel != null) {
}
}
} else {
}
return view;
}
protected void createPageTitleModel() {
}
protected void createPropertyModel() {
} else {
}
}
super.beginDisplay(event);
if (!submitCycle) {
try {
} catch (AMConsoleException e) {
throw new ModelControlException(e);
}
} else {
}
}
}
try {
} else {
}
} catch (AMConsoleException e) {
throw new IllegalStateException("Exception getting model in STSEditViewBeanBase: " + e.getMessage(), e);
}
}
/**
* Handles save button request. Validates the rest sts configuration state, and invokes the model to publish a
* rest sts instance corresponding to this state.
* @param event Request invocation event
*/
submitCycle = true;
try {
Map<String, Set<String>> configurationState = getUpdatedConfigurationState(currentRealm, instanceName);
if (configurationState.isEmpty()) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", getModel().getLocalizedString("rest.sts.view.no.updates"));
} else {
MessageFormat.format(getModel().getLocalizedString("rest.sts.view.no.edit.deployment.url"), instanceName));
} else {
STSInstanceModelResponse validationResponse = model.validateConfigurationState(stsType, configurationState);
if (validationResponse.isSuccessful()) {
try {
STSInstanceModelResponse creationResponse = model.updateInstance(stsType, configurationState, currentRealm, instanceName);
if (creationResponse.isSuccessful()) {
} else {
}
} catch (AMConsoleException e) {
throw new ModelControlException(e);
}
} else {
}
}
}
} catch (AMConsoleException e) {
//getUpdatedConfigurationState will throw this exception if passwords are mis-matched.
}
forwardTo();
}
}
/**
* Handles reset button request.
*
* @param event Request invocation event
*/
forwardTo();
}
/**
* Handles back button request.
*
* @param event Request invocation event
*/
public void handleButton3Request(RequestInvocationEvent event) throws ModelControlException, AMConsoleException {
}
protected void disableSaveButton() {
disableButton("button1", true);
}
/**
* Called to harvest the full set of updated configuration properties.
* @param realm
* @param instanceName
* @return The set up updated properties. An empty-set will be returned if no properties updated.
* @throws ModelControlException thrown by AMPropertySheet#getAttributeValues if model for property-sheet cannot be
* obtained
* @throws AMConsoleException thrown by AMPropertySheet#getAttributeValues if passwords are mis-matched.
*/
private Map<String, Set<String>> getUpdatedConfigurationState(String realm, String instanceName) throws ModelControlException, AMConsoleException {
try {
} catch (AMConsoleException e) {
throw new ModelControlException(e.getMessage(), e);
}
Map<String, Set<String>> updatedValues = ps.getAttributeValues(currentPersistedInstanceState, model);
if (updatedValues.isEmpty()) {
return updatedValues;
} else {
return currentPersistedInstanceState;
}
}
/*
The deploymentUrl of an existing sts instance cannot be edited, as it constitutes (along with the realm) the dn of the
rest-sts instance state. This method returns true if the changes include the deployment url.
*/
private boolean instanceNameUpdated(String realm, String instanceName) throws ModelControlException, AMConsoleException {
try {
} catch (AMConsoleException e) {
throw new ModelControlException(e.getMessage(), e);
}
Map<String, Set<String>> updatedValues = ps.getAttributeValues(currentPersistedInstanceState, model);
}
throw new AMConsoleException("No page session attribute corresponding to " + AMAdminConstants.SAVE_VB_NAME);
}
try {
} catch (ClassNotFoundException e) {
throw new AMConsoleException("Could not find class corresponding to class name "
+ name + ". Exception: " + e);
}
} else {
}
}
}