コード例 #1
0
  protected String getValues(Map map) throws AMConsoleException {
    String errorMessage = null;
    Set attributeNames = getAttributeNames();
    // Remove the password confirm from the attributes
    attributeNames.remove(SAMLConstants.AUTH_PASSWORD + SAMLPropertyTemplate.CONFIRM_SUFFIX);
    Map values = new HashMap(map.size() * 2);

    for (Iterator iter = attributeNames.iterator(); iter.hasNext(); ) {
      String attrName = (String) iter.next();
      String value = (String) propertySheetModel.getValue(attrName);

      if (attrName.equals(SAMLConstants.AUTH_PASSWORD)) {
        if ((value != null) && (value.length() > 0)) {
          String pwdConfirm =
              (String)
                  propertySheetModel.getValue(
                      SAMLConstants.AUTH_PASSWORD + SAMLPropertyTemplate.CONFIRM_SUFFIX);
          if ((pwdConfirm == null) || !pwdConfirm.equals(value)) {
            throw new AMConsoleException(
                "saml.profile.trustedPartners.user.password.mismatchedmessage");
          }
        }
      }

      if (value != null) {
        value = value.trim();
      } else {
        value = "";
      }
      values.put(attrName, value);
    }

    Set mandatory = getMandatoryAttributeNames();
    for (Iterator iter = mandatory.iterator(); iter.hasNext(); ) {
      String attrName = (String) iter.next();
      String value = (String) values.remove(attrName);
      map.put(attrName, value);

      if ((errorMessage == null) && (value.length() == 0)) {
        errorMessage = (String) errorMessages.get(attrName);
      }
    }

    // deal with the optional ones
    for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
      String attrName = (String) iter.next();
      String value = (String) values.get(attrName);
      if (value.length() > 0) {
        if (attrName.equals(SAMLConstants.AUTH_PASSWORD)) {
          map.put(attrName, (String) AccessController.doPrivileged(new EncryptAction(value)));
        } else {
          map.put(attrName, value);
        }
      }
    }
    return errorMessage;
  }
コード例 #2
0
 protected void registerChildren() {
   super.registerChildren();
   registerChild(PGTITLE, CCPageTitle.class);
   ptModel.registerChildren(this);
   registerChild(PROPERTY_ATTRIBUTE, AMPropertySheet.class);
   propertySheetModel.registerChildren(this);
 }
コード例 #3
0
  protected void setValues(Map map) {
    Map values = correctCaseOfAttributeNames(map);
    for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
      String attr = (String) iter.next();

      if (attr.equals(SAMLConstants.AUTH_PASSWORD)) {
        String pwd =
            (String) AccessController.doPrivileged(new DecodeAction((String) values.get(attr)));
        propertySheetModel.setValue(SAMLConstants.AUTH_PASSWORD, pwd);
        propertySheetModel.setValue(
            SAMLConstants.AUTH_PASSWORD + SAMLPropertyTemplate.CONFIRM_SUFFIX, pwd);
      } else {
        propertySheetModel.setValue(attr, values.get(attr));
      }
    }
  }
コード例 #4
0
  protected View createChild(String name) {
    View view = null;
    if (name.equals(PGTITLE)) {
      view = new CCPageTitle(this, ptModel, name);
    } else if (ptModel.isChildSupported(name)) {
      view = ptModel.createChild(this, name);
    } else if (name.equals(PROPERTY_ATTRIBUTE)) {
      view = new AMPropertySheet(this, propertySheetModel, name);
    } else if ((propertySheetModel != null) && propertySheetModel.isChildSupported(name)) {
      view = propertySheetModel.createChild(this, name, getModel());
    } else {
      view = super.createChild(name);
    }

    return view;
  }
コード例 #5
0
 protected void createPropertyModel() {
   propertySheetModel =
       new AMPropertySheetModel(
           getClass()
               .getClassLoader()
               .getResourceAsStream("com/sun/identity/console/propertyFSSAMLSiteIDProfile.xml"));
   propertySheetModel.clear();
 }
コード例 #6
0
  protected void setValues(String value) {
    try {
      URL url = new URL(value);
      propertySheetModel.setValue(ATTR_PROTOCOL, url.getProtocol());
      propertySheetModel.setValue(ATTR_TARGET, url.getHost());
      propertySheetModel.setValue(ATTR_PATH, url.getPath());
      int port = url.getPort();

      if (port == -1) {
        propertySheetModel.setValue(ATTR_PORT, "");
      } else {
        propertySheetModel.setValue(ATTR_PORT, Integer.toString(port));
      }
    } catch (MalformedURLException e) {
      debug.warning("FSSAMLTargetURLsViewBeanBase.setValues", e);
    }
  }
コード例 #7
0
 protected void createPropertyModel() {
   propertySheetModel =
       new AMPropertySheetModel(
           getClass()
               .getClassLoader()
               .getResourceAsStream(
                   "com/sun/identity/console/propertyWSAuthNServicesHandlers.xml"));
   propertySheetModel.clear();
 }
コード例 #8
0
  private String getValues(Map map) {
    String key = (String) propertySheetModel.getValue(ATTR_KEY);
    String clazz = (String) propertySheetModel.getValue(ATTR_CLASS);
    key = key.trim();
    clazz = clazz.trim();
    map.put(ATTR_KEY, key);
    map.put(ATTR_CLASS, clazz);

    String errorMsg = null;

    if (key.length() == 0) {
      errorMsg = "webservices.authentication.service.handlers.missing.key.message";
    } else if (clazz.length() == 0) {
      errorMsg = "webservices.authentication.service.handlers.missing.class.message";
    }

    return errorMsg;
  }
コード例 #9
0
 private void createPropertyModel() {
   propertySheetModel =
       new AMPropertySheetModel(
           getClass()
               .getClassLoader()
               .getResourceAsStream(
                   "com/sun/identity/console/propertyFSSAMLSelectTrustedPartnerType.xml"));
   propertySheetModel.clear();
 }
コード例 #10
0
  private String getValues(Map map) {
    String instanceID = (String) propertySheetModel.getValue(ATTR_INSTANCE_ID);
    String siteID = (String) propertySheetModel.getValue(ATTR_SITE_ID);
    String issuerName = (String) propertySheetModel.getValue(ATTR_ISSUER_NAME);
    map.put(SAMLConstants.INSTANCEID, instanceID.trim());
    map.put(SAMLConstants.SITEID, siteID.trim());
    map.put(SAMLConstants.ISSUERNAME, issuerName.trim());

    String errorMsg = null;
    if (instanceID.length() == 0) {
      errorMsg = "saml.profile.siteid.missing.instanceid.message";
    } else if (siteID.length() == 0) {
      errorMsg = "saml.profile.siteid.missing.siteid.message";
    } else if (issuerName.length() == 0) {
      errorMsg = "saml.profile.siteid.missing.issuername.message";
    }
    return errorMsg;
  }
コード例 #11
0
 private boolean createPropertyModel() {
   List profiles = (List) getPageSessionAttribute(PROFILES);
   if (profiles != null) {
     SAMLPropertyXMLBuilder builder = SAMLPropertyXMLBuilder.getInstance();
     propertySheetModel = new AMPropertySheetModel(builder.getXML(profiles, !isCreateViewBean()));
     propertySheetModel.clear();
     return true;
   }
   return false;
 }
コード例 #12
0
 private void createPropertyModel() {
   try {
     String schemaName =
         (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
     SubConfigModel model = (SubConfigModel) getModel();
     propertySheetModel = new AMPropertySheetModel(model.getAddConfigPropertyXML(schemaName));
     propertySheetModel.clear();
   } catch (AMConsoleException e) {
     setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
   }
 }
コード例 #13
0
  private boolean getValues(String[] results) {
    boolean ok = false;
    String protocol = ((String) propertySheetModel.getValue(ATTR_PROTOCOL)).trim();
    String target = ((String) propertySheetModel.getValue(ATTR_TARGET)).trim();
    String port = ((String) propertySheetModel.getValue(ATTR_PORT)).trim();
    String path = ((String) propertySheetModel.getValue(ATTR_PATH)).trim();

    String errorMsg = null;
    StringBuffer buff = new StringBuffer(200);
    buff.append(protocol).append("://").append(target);

    if (port.length() > 0) {
      buff.append(":").append(port);
    }

    if (path.length() > 0) {
      if (path.charAt(0) == '/') {
        buff.append(path);
      } else {
        buff.append("/").append(path);
      }
    }

    String url = buff.toString();

    try {
      new URL(url);
      results[0] = url;
      results[1] = null;

      if ((protocol.length() == 0) || (target.length() == 0)) {
        results[1] = "saml.profile.targetURLs.incorrect.url";
      } else {
        ok = true;
      }
    } catch (MalformedURLException e) {
      results[1] = "saml.profile.targetURLs.incorrect.url";
    }

    return ok;
  }
コード例 #14
0
  public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    String schemaName =
        (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);

    if (!submitCycle) {
      AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
      propertySheetModel.clear();

      try {
        ps.setAttributeValues(model.getServiceSchemaDefaultValues(schemaName), model);
      } catch (AMConsoleException a) {
        setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "noproperties.message");
      }
    }

    Set subconfigNames = model.getSelectableConfigNames(schemaName);
    if ((subconfigNames != null) && !subconfigNames.isEmpty()) {
      CCDropDownMenu menu = (CCDropDownMenu) getChild(ATTR_SUBCONFIG_NAME);
      OptionList optList = this.createOptionList(subconfigNames);
      menu.setOptions(optList);
    }
  }
コード例 #15
0
 protected void setValues(String value) {
   WSAuthHandlerEntry entry = new WSAuthHandlerEntry(value);
   propertySheetModel.setValue(ATTR_KEY, entry.strKey);
   propertySheetModel.setValue(ATTR_CLASS, entry.strClass);
 }
コード例 #16
0
 protected void setValues(Map values) {
   Map upcase = AMAdminUtils.upCaseKeys(values);
   propertySheetModel.setValue(ATTR_INSTANCE_ID, upcase.get(SAMLConstants.INSTANCEID));
   propertySheetModel.setValue(ATTR_SITE_ID, upcase.get(SAMLConstants.SITEID));
   propertySheetModel.setValue(ATTR_ISSUER_NAME, upcase.get(SAMLConstants.ISSUERNAME));
 }