public static String getOpenIDLoginPageURL() { // Read from OpenID configuration in identity.xml String openIDServerURL = IdentityUtil.getProperty(IdentityConstants.ServerConfig.OPENID_LOGIN_PAGE_URL); // If configuration are not defined, build URL from server configurations. if (StringUtils.isBlank(openIDServerURL)) { openIDServerURL = IdentityUtil.getServerURL("/authenticationendpoint/openid_login.do", false, false); } return openIDServerURL; }
/** * Check the case sensitivity of the user store in which the user is in. * * @param username user name with user store domain * @param tenantId tenant id of the user * @return */ public static boolean isUserStoreInUsernameCaseSensitive(String username, int tenantId) { return isUserStoreCaseSensitive(IdentityUtil.extractDomainFromName(username), tenantId); }
public static String getGroupNameWithDomain(String groupName) { if (groupName == null) { return groupName; } if (groupName.indexOf(CarbonConstants.DOMAIN_SEPARATOR) > 0) { return groupName; } else { return IdentityUtil.getPrimaryDomainName() + CarbonConstants.DOMAIN_SEPARATOR + groupName; } }
/** * Private constructor which will not allow to create objects of this class from outside */ private AuthenticationContextCache() { super(AUTHENTICATION_CONTEXT_CACHE_NAME, true); if (IdentityUtil.getProperty("JDBCPersistenceManager.SessionDataPersist.Temporary") != null) { isTemporarySessionDataPersistEnabled = Boolean.parseBoolean( IdentityUtil.getProperty("JDBCPersistenceManager.SessionDataPersist.Temporary")); } }
public LocalRole(String combinedRoleName) { this.userStoreId = IdentityUtil.extractDomainFromName(combinedRoleName); this.localRoleName = UserCoreUtil.removeDomainFromName(combinedRoleName); }
public int getOrderId() { IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty (UserOperationEventListener.class.getName(), this.getClass().getName()); if (identityEventListenerConfig == null) { return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID; } return identityEventListenerConfig.getOrder(); } }
/** * * This method provides a secured document builder which will secure XXE attacks. * * @return DocumentBuilder * @throws ParserConfigurationException */ private DocumentBuilder getSecuredDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder; }
public static String getFronEndUrl(String openId, HttpServletRequest request, String relativeUrl) { String tenant = MultitenantUtils.getDomainNameFromOpenId(openId); if (getHostName().equals(tenant)) { tenant = null; } String frontEndUrl = IdentityUtil.getServerURL("/carbon/", false, true) + relativeUrl; if (tenant != null && tenant.trim().length() > 0) { return frontEndUrl.replace("/carbon/", "/t/" + tenant + "/carbon/"); } return frontEndUrl; }
@Override public boolean isAccountLocked(String username, String tenantDomain, String userStoreDomain) throws AccountLockServiceException { return isAccountLocked(IdentityUtil.addDomainToName(username, userStoreDomain), tenantDomain); }
/** * To check whether user claims in token is loggable. * * @return true if the user claims in token is loggable, otherwise false. */ private static boolean isUserClaimsInTokenLoggable() { return IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_CLAIMS); }
/** * To get account lock error code from identity error message context. * * @return the error code */ private String getErrorCode() { String errorCode = null; IdentityErrorMsgContext errorContext = IdentityUtil.getIdentityErrorMsg(); IdentityUtil.clearIdentityErrorMsg(); if (errorContext != null && errorContext.getErrorCode() != null) { if (log.isDebugEnabled()) { log.debug("Retrieving error code " + errorContext.getErrorCode() + " from identity error message " + "context "); } errorCode = errorContext.getErrorCode(); } return errorCode; }
/** * Private constructor which will not allow to create objects of this class from outside */ private AuthenticationContextCache() { super(AUTHENTICATION_CONTEXT_CACHE_NAME); if (IdentityUtil.getProperty("JDBCPersistenceManager.SessionDataPersist.Temporary") != null) { isTemporarySessionDataPersistEnabled = Boolean.parseBoolean( IdentityUtil.getProperty("JDBCPersistenceManager.SessionDataPersist.Temporary")); } }
public LocalRole(String combinedRoleName) { this.userStoreId = IdentityUtil.extractDomainFromName(combinedRoleName); this.localRoleName = UserCoreUtil.removeDomainFromName(combinedRoleName); }
@Override public boolean isEnabled() { IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty (AbstractIdentityHandler.class.getName(), this.getClass().getName()); if (identityEventListenerConfig == null) { return true; } return Boolean.parseBoolean(identityEventListenerConfig.getEnable()); }
/** * * This method provides a secured document builder which will secure XXE attacks. * * @return DocumentBuilder * @throws ParserConfigurationException */ private DocumentBuilder getSecuredDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder; }
public static String getFronEndUrl(String openId, HttpServletRequest request, String relativeUrl) { String tenant = MultitenantUtils.getDomainNameFromOpenId(openId); if (getHostName().equals(tenant)) { tenant = null; } String frontEndUrl = IdentityUtil.getServerURL("/carbon/", false, true) + relativeUrl; if (tenant != null && tenant.trim().length() > 0) { return frontEndUrl.replace("/carbon/", "/t/" + tenant + "/carbon/"); } return frontEndUrl; }
/** * Returns full qualified username of the {@link User} object. * ie. We append the tenantDomain and userStoreDomain to the username. * <p> * Note that the PRIMARY domain will not be appended to username when building the full qualified username. * Therefore a full qualified name without the userStoreDomain indicates the user belongs to the PRIMARY * userStoreDomain. * * @return full qualified username */ public String toFullQualifiedUsername() { String username = null; if (StringUtils.isNotBlank(this.userName)) { username = this.userName; if (StringUtils.isNotBlank(this.tenantDomain)) { username = UserCoreUtil.addTenantDomainToEntry(username, tenantDomain); } if (StringUtils.isNotBlank(this.userStoreDomain)) { username = IdentityUtil.addDomainToName(username, userStoreDomain); } } return username; }
/** * Test request for PDP * * @param xacmlRequest XACML request as String * @return response as String */ public String test(String xacmlRequest) { if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_REQUEST)) { log.debug("XACML Request : " + xacmlRequest); } String xacmlResponse = pdpTest.evaluate(xacmlRequest); if (log.isDebugEnabled() && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.XACML_RESPONSE)) { log.debug("XACML Response : " + xacmlResponse); } return xacmlResponse; }
/** * To get account lock error code from identity error message context. * * @return the error code */ private String getErrorCode() { String errorCode = null; IdentityErrorMsgContext errorContext = IdentityUtil.getIdentityErrorMsg(); IdentityUtil.clearIdentityErrorMsg(); if (errorContext != null && errorContext.getErrorCode() != null) { if (log.isDebugEnabled()) { log.debug("Retrieving error code " + errorContext.getErrorCode() + " from identity error message " + "context "); } errorCode = errorContext.getErrorCode(); } return errorCode; }
public static String getNotificationEndpoint(){ String redirectURL = IdentityUtil.getProperty(IdentityConstants.ServerConfig .NOTIFICATION_ENDPOINT); if (StringUtils.isBlank(redirectURL)){ redirectURL = IdentityUtil.getServerURL(SAMLSSOConstants.NOTIFICATION_ENDPOINT, false, false); } return redirectURL; }