Search in sources :

Example 1 with SocialAuthNModel

use of com.sun.identity.console.task.model.SocialAuthNModel in project OpenAM by OpenRock.

the class ConfigureSocialAuthNViewBean method beginDisplay.

@Override
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    HttpServletRequest req = getRequestContext().getRequest();
    try {
        super.beginDisplay(event);
        SocialAuthNModel model = (SocialAuthNModel) getModel();
        // If provider is known then use the simplified property sheet
        if (model.isKnownProvider()) {
            propertySheetModel.setDocument(openPropertySheetXml(KNOWN_PROVIDER_PROPERTIES));
            final String titleMessage = model.getLocalizedString(TITLE_MESSAGE);
            ptModel.setPageTitleText(MessageFormat.format(titleMessage, model.getProviderDisplayName()));
            ptModel.setPageTitleHelpMessage(model.getLocalizedProviderHelpMessage());
        }
        SortedSet<String> realms = model.getRealms();
        CCDropDownMenu menuRealm = (CCDropDownMenu) getChild(REALM_FIELD);
        menuRealm.setOptions(createOptionList(realms));
        String realm = req.getParameter("realm");
        if (realm != null && !realm.trim().isEmpty()) {
            setDisplayFieldValue(REALM_FIELD, realm);
        }
        setDisplayFieldValue(REDIRECT_URL_FIELD, model.getDefaultRedirectUrl());
        String provider = req.getParameter("type");
        if (provider != null && !provider.trim().isEmpty()) {
            setPageSessionAttribute(PROVIDER_ATTR, provider.trim());
        }
    } catch (AMConsoleException ex) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ex.getMessage());
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) SocialAuthNModel(com.sun.identity.console.task.model.SocialAuthNModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 SocialAuthNModel (com.sun.identity.console.task.model.SocialAuthNModel)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1