⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateglobalusermanagementpropertiesaction.java

📁 开源的OpenId的一个java实现
💻 JAVA
字号:
/* * Copyright 2005-2007 WSO2, Inc. (http://wso2.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.wso2.solutions.identity.admin.ui.action;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.wso2.solutions.identity.IdentityProviderConstants;import org.wso2.solutions.identity.IdentityProviderException;import org.wso2.solutions.identity.admin.EmailActivatorAdmin;import org.wso2.solutions.identity.admin.ParameterAdmin;public class UpdateGlobalUserManagementPropertiesAction extends ManagedAction {    private static final long serialVersionUID = 6216903789893924781L;    private boolean allowUserRegistration;    private boolean enableEmailVerification;    private boolean enableOpenIDRegistration;    private String port = null;    private String host = null;    private String fromAddress = null;    private String username = null;    private String password = null;    private static Log log = LogFactory            .getLog(UpdateGlobalUserManagementPropertiesAction.class);    @Override    public String execute() throws Exception {        try {            ParameterAdmin admin = new ParameterAdmin();            if (enableEmailVerification) {                if (port.length() == 0 || host.length() == 0                        || fromAddress.length() == 0) {                    this.addErrorMessage(getText("required_feild_missing"));                    loadMessages();                    return ERROR;                }                this.host = host.trim();                this.fromAddress = fromAddress.trim();                this.username = username.trim();                this.password = password.trim();                this.port = port.trim();                try {                    Integer.parseInt(port);                } catch (NumberFormatException e) {                    this.addErrorMessage(getText("invalid_data_for",                            new String[] { "port" }));                    loadMessages();                    return ERROR;                }                EmailActivatorAdmin eadmin = new EmailActivatorAdmin();                eadmin.createParamsAndInstanciateEmailVerifier(port, host,                        fromAddress, username, password);            } else {                admin                        .removeParam(IdentityProviderConstants.PARAM_NAME_ENABLE_EMAIL_VERIFICATION);            }            if (allowUserRegistration) {                admin                        .createOrUpdatearameter(                                IdentityProviderConstants.PARAM_NAME_ALLOW_USER_REGISTRATION,                                null);            } else {                admin                        .removeParam(IdentityProviderConstants.PARAM_NAME_ALLOW_USER_REGISTRATION);            }            if (enableOpenIDRegistration) {                admin                        .createOrUpdatearameter(                                IdentityProviderConstants.PARAM_NAME_ENABLE_OPENID_REGISTRATION,                                null);            } else {                admin                        .removeParam(IdentityProviderConstants.PARAM_NAME_ENABLE_OPENID_REGISTRATION);            }        } catch (IdentityProviderException e) {            this.addErrorMessage(getText("error_unexpected", new String[] { e                    .getMessage() }));            ;            log.error(e.getMessage(), e);            loadMessages();            return ERROR;        }        return SUCCESS;    }    public void setAllowUserRegistration(boolean allowUserRegistration) {        this.allowUserRegistration = allowUserRegistration;    }    public void setEnableEmailVerification(boolean enableEmailVerification) {        this.enableEmailVerification = enableEmailVerification;    }    public String getPort() {        return port;    }    public String getHost() {        return host;    }    public void setHost(String host) {        this.host = host;    }    public String getFromAddress() {        return fromAddress;    }    public void setFromAddress(String fromAddress) {        this.fromAddress = fromAddress;    }    public String getUsername() {        return username;    }    public void setUsername(String username) {        this.username = username;    }    public String getPassword() {        return password;    }    public void setPassword(String password) {        this.password = password;    }    public boolean isAllowUserRegistration() {        return allowUserRegistration;    }    public boolean isEnableEmailVerification() {        return enableEmailVerification;    }    public void setPort(String port) {        this.port = port;    }    public boolean isEnableOpenIDRegistration() {        return enableOpenIDRegistration;    }    public void setEnableOpenIDRegistration(boolean enableOpenIDRegistration) {        this.enableOpenIDRegistration = enableOpenIDRegistration;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -