Examples of IdentityPersistenceManager


Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

    public String[] getAllOpenIDs(String userName) throws Exception {
        validateInputParameters(new String[]{userName},
                "Invalid parameters provided to getAllOpenIDs");
        // checkUserAuthorization(extractPrimaryUserName(userName), "getAllOpenIDs");

        IdentityPersistenceManager persistenceManager = IdentityPersistenceManager.getPersistanceManager();

        // Get all External OpenIDs of an user
        String[] externalOpenIDs = persistenceManager.getOpenIDsForUser(IdentityTenantUtil.getRegistry()
                ,AdminServicesUtil.getUserRealm(), userName);

        String[] openIDset = new String[externalOpenIDs.length + 1];
        // Index zero of the returning array would be the primary OpenID.
        openIDset[0] = getPrimaryOpenID(userName);
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     */
    public static String getPPID(RahasData rahasData, String name, OMElement appliesToEpr)
            throws IdentityProviderException {

        String appliesToHostName = IdentityProviderUtil.getAppliesToHostName(rahasData);
        IdentityPersistenceManager db = null;

        try {
            db = IdentityPersistenceManager.getPersistanceManager();
            PPIDValueDO[] ppidValueDOs = db.getPPIDValuesForUser(IdentityTenantUtil.getRegistry(
                    null, name), name);
            PPIDValueDO ppidValueDO = null;
            for (int i = 0; i < ppidValueDOs.length; i++) {
                String hostName = null;
                if (ppidValueDOs[i].getRelyingParty() != null) {
                    hostName = ppidValueDOs[i].getRelyingParty().getHostName();
                } else if (ppidValueDOs[i].getPersonalRelyingParty() != null) {
                    hostName = ppidValueDOs[i].getPersonalRelyingParty().getIdentifier()
                            .getHostName();
                }

                // hostName is not-null on both globally trusted relying parties and
                // user trusted relying parties

                // Check whether the host name matches
                if (appliesToHostName.equals(hostName)) {
                    ppidValueDO = ppidValueDOs[i];
                }
            }

            if (ppidValueDO != null) {
                // If we have already issued a PPID
                // Then return that value
                return ppidValueDO.getPpid();
            } else {
                // A new request targeted for a new RP
                String newPpid = Base64.encode(UUIDGenerator.getUUID().getBytes());
                ppidValueDO = new PPIDValueDO();
                ppidValueDO.setUserId(name);
                ppidValueDO.setPpid(newPpid);

                // If the host is globally trusted
                RelyingPartyDO rp = db.getGloballyTrustedRelyingParty(IdentityTenantUtil
                        .getRegistry(null, name), appliesToHostName);
                if (rp != null) {
                    ppidValueDO.setRelyingParty(rp);
                } else {
                    // Else the host MUST be personally trusted
                    ppidValueDO.setPersonalRelyingParty(db.getUserTrustedRelyingParty(
                            IdentityTenantUtil.getRegistry(), name, appliesToHostName));
                }

                db.createPPIDValue(IdentityTenantUtil.getRegistry(null, name), ppidValueDO);

                return newPpid;
            }
        } catch (Exception e) {
            throw new IdentityProviderException(e.getMessage(), e);
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

    }

    public void removeOpenID(String openID) {
        try {

            IdentityPersistenceManager persistenceManager = IdentityPersistenceManager.getPersistanceManager();
            persistenceManager.removeOpenIDSignUp(IdentityTenantUtil.getRegistry(),
                    AdminServicesUtil.getUserRealm(), openID);

        } catch (Exception e) {
            log.error("Error instantiating a Persistence Manager.", e);
        }
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     */
    protected boolean checkIsValidTokenType(GenericIdentityProviderData data)
            throws IdentityProviderException {
        boolean isValid = false;
        String type = data.getRequiredTokenType();
        IdentityPersistenceManager admin = null;
        String types = null;
        String[] arrTypes = null;

        try {
            admin = IdentityPersistenceManager.getPersistanceManager();
            types = admin.getParameterValue(IdentityTenantUtil.getRegistry(null, data
                    .getUserIdentifier()), IdentityConstants.PARAM_SUPPORTED_TOKEN_TYPES);
        } catch (IdentityException e) {
            throw new IdentityProviderException(e.getMessage(), e);
        }

View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     * @return
     * @throws IdentityProviderException
     */
    protected X509Certificate readRpCertFromStores(RahasData data) throws IdentityProviderException {
        X509Certificate cert = null;
        IdentityPersistenceManager dbman = null;
        String host = null;
        RelyingPartyDO rp = null;
        String alias = null;
        String keyStoreName = null;
        ServerConfiguration serverConfig = null;

        host = IdentityProviderUtil.getAppliesToHostName(data);
        serverConfig = ServerConfiguration.getInstance();
        String userName = UserCoreUtil.getTenantLessUsername(userIdentifier);

        try {
            dbman = IdentityPersistenceManager.getPersistanceManager();
        } catch (Exception e) {
            log.error("Error while instantiating IdentityUserStore", e);
            throw new IdentityProviderException("Error while instantiating IdentityUserStore", e);
        }

        try {
      rp = dbman.getGloballyTrustedRelyingParty(IdentityTenantUtil
          .getRegistry(null, userName), host);
    } catch (Exception ignore) {
      // Lets proceed with the user trusted relying parties.
    }

        keyStoreName = serverConfig.getFirstProperty("Security.KeyStore.Location");

        if (rp != null) {
            // This is a globally trusted RP
            alias = rp.getAlias();
            // Get key store name
            try {
                cert = KeyUtil.getCertificate(new File(keyStoreName).getName(), alias);
            } catch (IdentityException e) {
                log.error("Error while retrieving cert from the key store", e);
                throw new IdentityProviderException(
                        "Error while retrieving cert from the key store", e);
            }
        } else {
            // If the RP is not trusted globally then check personal RPs
            try {             
                UserTrustedRPDO userRp = dbman.getUserTrustedRelyingParty(IdentityTenantUtil
                        .getRegistry(null,userName), userName, host);
                if (userRp != null) {
                    alias = userRp.getIdentifier().getHostName();
                    cert = getCertificateFromUserTrustedRP(alias);
                }
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

    private static final String OPENID_PATTERN_1 = "https://{subdomain}.yourdomain/openid/{userName}";
    private static final String OPENID_PATTERN_2 = "https://{user}.yourdomain/openid";

    public OpenIDConfigurationDTO getOpenIDConfiguration(String userName, String domainName)
            throws Exception {
        IdentityPersistenceManager persistenceManager = null;
        OpenIDAdminDO opdo = null;
        OpenIDConfigurationDTO configuration = null;

        persistenceManager = IdentityPersistenceManager.getPersistanceManager();
        opdo = persistenceManager.getOpenIDAdmin(IdentityTenantUtil.getRegistry());
        configuration = new OpenIDConfigurationDTO();
        configuration.setUserName(userName);
        configuration.setDomainName(domainName);
        if (opdo != null) {
            configuration.setSubDomain(opdo.getSubDomain());
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

        return configuration;
    }

    public void createOrUpdateOpenIDCOnfiguration(OpenIDConfigurationDTO configuration)
            throws Exception {
        IdentityPersistenceManager persistenceManager = null;
        OpenIDAdminDO opdo = null;

        persistenceManager = IdentityPersistenceManager.getPersistanceManager();
        opdo = new OpenIDAdminDO();
        opdo.setSubDomain(configuration.getSubDomain());
        opdo.setTenantOpenIDPattern(configuration.getTenantOpenIDPattern());
        persistenceManager.createOrUpdateOpenIDAdmin(IdentityTenantUtil.getRegistry(), opdo);
    }
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     * To add XMPP Settings.
     * @param dto
     */
    public void addXmppSettings(XMPPSettingsDTO dto){
    try {
            IdentityPersistenceManager persistentManager = IdentityPersistenceManager.getPersistanceManager();
            persistentManager.addXmppSettings(IdentityTenantUtil.getRegistry(), dto.getUserId(), dto.getXmppServer(),dto.getXmppUserName(),
                    dto.getUserCode(),dto.isXmppEnabled(), dto.isPINEnabled());

        } catch (Exception e) {
            log.error("Error when instantiating the Persistence Manager.", e);
        }
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     * To edit XMPP Settings.
     * @param dto
     */
    public void editXmppSettings(XMPPSettingsDTO dto){
        try {
            IdentityPersistenceManager persistentManager = IdentityPersistenceManager.getPersistanceManager();
            persistentManager.updateXmppSettings(IdentityTenantUtil.getRegistry(),dto.getUserId(),
                    dto.getXmppServer(),dto.getXmppUserName(), dto.getUserCode(),dto.isXmppEnabled(), dto.isPINEnabled());

        } catch (Exception e) {
             log.error("Error when instantiating the Persistence Manager.", e);
        }
View Full Code Here

Examples of org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager

     * @return XmppSettingsDTO instance containing XMPP properties
     */
    public XMPPSettingsDTO getXmppSettings(String userId){
        XMPPSettingsDTO xmppSettingsDTO = null;
        try {
            IdentityPersistenceManager persistenceManager =  IdentityPersistenceManager.getPersistanceManager();
            XMPPSettingsDO xmppSettingsDO = persistenceManager.getXmppSettings(IdentityTenantUtil.getRegistry(), userId);
            xmppSettingsDTO = new XMPPSettingsDTO();
            xmppSettingsDTO.setXmppServer(xmppSettingsDO.getXmppServer());
            xmppSettingsDTO.setXmppUserName(xmppSettingsDO.getXmppUserName());
            xmppSettingsDTO.setUserCode(xmppSettingsDO.getUserCode());
            xmppSettingsDTO.setXmppEnabled(xmppSettingsDO.isXmppEnabled());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.