本文整理汇总了Java中org.wso2.carbon.user.core.UserCoreConstants.TENANT_DOMAIN_COMBINER属性的典型用法代码示例。如果您正苦于以下问题:Java UserCoreConstants.TENANT_DOMAIN_COMBINER属性的具体用法?Java UserCoreConstants.TENANT_DOMAIN_COMBINER怎么用?Java UserCoreConstants.TENANT_DOMAIN_COMBINER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.wso2.carbon.user.core.UserCoreConstants
的用法示例。
在下文中一共展示了UserCoreConstants.TENANT_DOMAIN_COMBINER属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTenantCreate
@Override
public void onTenantCreate(TenantInfoBean tenantInfoBean) throws StratosException {
String fullName = tenantInfoBean.getAdmin() + UserCoreConstants.TENANT_DOMAIN_COMBINER + tenantInfoBean.getTenantDomain() ;
BPSProfile bpsProfileDTO = new BPSProfile();
String url = IdentityUtil.getServerURL(WorkflowImplServiceDataHolder.getInstance()
.getConfigurationContextService().getServerConfigContext().getServicePath(), true, true);
try {
bpsProfileDTO.setManagerHostURL(url);
bpsProfileDTO.setWorkerHostURL(url);
bpsProfileDTO.setUsername(fullName);
bpsProfileDTO.setPassword(new char[0]);
bpsProfileDTO.setProfileName(WFImplConstant.DEFAULT_BPS_PROFILE_NAME);
WorkflowImplServiceDataHolder.getInstance().getWorkflowImplService()
.addBPSProfile(bpsProfileDTO, tenantInfoBean
.getTenantId());
}catch (WorkflowImplException e) {
//This is not thrown exception because this is not blocked to the other functionality. User can create
// default profile by manually.
String errorMsg = "Error occured while adding default bps profile, " + e.getMessage();
log.error(errorMsg);
}
}
示例2: logout
public void logout() {
String loggedInUser;
String delegatedBy;
Date currentTime = Calendar.getInstance().getTime();
SimpleDateFormat date = new SimpleDateFormat("'['yyyy-MM-dd HH:mm:ss,SSSS']'");
HttpSession session = getHttpSession();
if (session != null) {
loggedInUser = (String) session.getAttribute(ServerConstants.USER_LOGGED_IN);
delegatedBy = (String) session.getAttribute("DELEGATED_BY");
if (StringUtils.isNotBlank(loggedInUser)) {
String logMessage = "'" + loggedInUser + "' logged out at " + date.format(currentTime);
if (delegatedBy != null) {
logMessage += " delegated by " + delegatedBy;
}
log.info(logMessage);
}
session.invalidate();
if (loggedInUser != null && AUDIT_LOG.isInfoEnabled()) {
// username in the session is in tenantAware manner
String tenantAwareUsername = loggedInUser;
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
String auditInitiator = tenantAwareUsername + UserCoreConstants.TENANT_DOMAIN_COMBINER + tenantDomain;
String auditData = delegatedBy != null ? "Delegated By : " + delegatedBy : "";
AUDIT_LOG.info(String.format(SAML2SSOAuthenticatorConstants.AUDIT_MESSAGE,
auditInitiator, SAML2SSOAuthenticatorConstants.AUDIT_ACTION_LOGOUT, AUTHENTICATOR_NAME,
auditData, SAML2SSOAuthenticatorConstants.AUDIT_RESULT_SUCCESS));
}
}
}
示例3: unauthenticate
public void unauthenticate(Object o) throws Exception {
String auditResult = SAML2SSOAuthenticatorConstants.AUDIT_RESULT_FAILED;
HttpServletRequest request = null;
HttpSession session = null;
if (o instanceof HttpSession) {
session = (HttpSession) o;
} else {
request = (HttpServletRequest) o;
session = request.getSession();
}
String username = (String) session.getAttribute(CarbonConstants.LOGGED_USER);
ServletContext servletContext = session.getServletContext();
ConfigurationContext configContext = (ConfigurationContext) servletContext
.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
String backendServerURL = CarbonUIUtil.getServerURL(servletContext, session);
try {
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_AUTH_TOKEN);
SAML2SSOAuthenticationClient authClient = new SAML2SSOAuthenticationClient(configContext,
backendServerURL,
cookie,
session);
authClient.logout(session);
// // memory cleanup : remove the invalid session from the invalid session list at the SSOSessionManager
// CarbonSSOSessionManager ssoSessionManager =
// SAML2SSOAuthFEDataHolder.getInstance().getCarbonSSOSessionManager();
// ssoSessionManager.removeInvalidSession(session.getId());
if (request != null) {
// this attribute is used to avoid generate the logout request
request.setAttribute(SAML2SSOAuthenticatorConstants.HTTP_ATTR_IS_LOGOUT_REQ, Boolean.valueOf(true));
request.setAttribute(SAML2SSOAuthenticatorConstants.LOGGED_IN_USER, session.getAttribute(
"logged-user"));
if(!Util.isLogoutSupportedIDP()) {
request.setAttribute(SAML2SSOAuthenticatorConstants.EXTERNAL_LOGOUT_PAGE, Util.getExternalLogoutPage());
}
}
auditResult = SAML2SSOAuthenticatorConstants.AUDIT_RESULT_SUCCESS;
if(username != null && !"".equals(username.trim())
&& request != null && "true".equalsIgnoreCase(request.getParameter("logoutcomplete"))) {
if(session.getAttribute("tenantDomain") != null) {
// Build username for authorized user login
// username in the session is in tenantAware manner
username = username + UserCoreConstants.TENANT_DOMAIN_COMBINER
+ PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
} else {
// Keep same username for unauthorized user login
}
log.info(username + " successfully logged out");
}
} catch (Exception ignored) {
String msg = "Configuration context is null.";
log.error(msg);
throw new Exception(msg);
} finally {
if (username != null && username.trim().length() > 0 && AUDIT_LOG.isInfoEnabled()
&& request != null && "true".equalsIgnoreCase(request.getParameter("logoutcomplete"))) {
// use the username built above (when printing info log)
String auditInitiator = username;
String auditData = "";
AUDIT_LOG.info(String.format(SAML2SSOAuthenticatorConstants.AUDIT_MESSAGE,
auditInitiator, SAML2SSOAuthenticatorConstants.AUDIT_ACTION_LOGOUT, AUTHENTICATOR_NAME,
auditData, auditResult));
}
}
}