Examples of HibernateIdentityObjectCredential


Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredential hibernateCredential = null;

         hibernateCredential = (HibernateIdentityObjectCredential)getHibernateSession(ctx).
            createQuery(HibernateIdentityObjectCredential.findIdentityObjectCredentialByIOAndTypeNAme).
            setParameter("typeName", credential.getType().getName()).
            setParameter("identityObject", hibernateObject).uniqueResult();



         if (hibernateCredential == null)
         {
            return false;
         }

         // Handle generic impl

         Object value = null;

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String && hibernateCredential.getTextValue() != null)
         {
            return value.toString().equals(hibernateCredential.getTextValue());
         }
         else if (value instanceof byte[] && hibernateCredential.getBinaryValue() != null)
         {
            return Arrays.equals((byte[])value, hibernateCredential.getBinaryValue());
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

         if (hibernateCredentialType == null)
         {
            throw new IllegalStateException("Credential type not present in this store: " + credential.getType().getName());
         }

         HibernateIdentityObjectCredential hibernateCredential = hibernateObject.getCredential(credential.getType());

         if (hibernateCredential == null)
         {
            hibernateCredential = new HibernateIdentityObjectCredential();
            hibernateCredential.setType(hibernateCredentialType);
            hibernateObject.addCredential(hibernateCredential);
         }


         Object value = null;

         // Handle generic impl

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String)
         {
            hibernateCredential.setTextValue(value.toString());
         }
         else if (value instanceof byte[])
         {
            hibernateCredential.setBinaryValue((byte[])value);
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

         if (hibernateCredentialType == null)
         {
            throw new IllegalStateException("Credential type not present in this store: " + credential.getType().getName());
         }

         HibernateIdentityObjectCredential hibernateCredential = new HibernateIdentityObjectCredential();
         hibernateCredential.setIdentityObject(hibernateObject);
         hibernateCredential.setType(hibernateCredentialType);

         Object value = null;

         // Handle generic impl

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String)
         {
            hibernateCredential.setTextValue(value.toString());
         }
         else if (value instanceof byte[])
         {
            hibernateCredential.setBinaryValue((byte[])value);
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredential hibernateCredential = hibernateObject.getCredentials().get(credential.getType().getName());

         if (hibernateCredential == null)
         {
            return false;
         }

         // Handle generic impl

         Object value = null;

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String && hibernateCredential.getTextValue() != null)
         {
            return value.toString().equals(hibernateCredential.getTextValue());
         }
         else if (value instanceof byte[] && hibernateCredential.getBinaryValue() != null)
         {
            return Arrays.equals((byte[])value, hibernateCredential.getBinaryValue());
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredential hibernateCredential = hibernateObject.getCredentials().get(credential.getType().getName());

         if (hibernateCredential == null)
         {
            return false;
         }

         // Handle generic impl

         Object value = null;

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String && hibernateCredential.getTextValue() != null)
         {
            return value.toString().equals(hibernateCredential.getTextValue());
         }
         else if (value instanceof byte[] && hibernateCredential.getBinaryValue() != null)
         {
            return Arrays.equals((byte[])value, hibernateCredential.getBinaryValue());
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

         if (hibernateCredentialType == null)
         {
            throw new IllegalStateException("Credential type not present in this store: " + credential.getType().getName());
         }

         HibernateIdentityObjectCredential hibernateCredential = new HibernateIdentityObjectCredential();
         hibernateCredential.setIdentityObject(hibernateObject);
         hibernateCredential.setType(hibernateCredentialType);

         Object value = null;

         // Handle generic impl

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String)
         {
            hibernateCredential.setTextValue(value.toString());
         }
         else if (value instanceof byte[])
         {
            hibernateCredential.setBinaryValue((byte[])value);
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredential hibernateCredential = null;

         hibernateCredential = (HibernateIdentityObjectCredential)getHibernateSession(ctx).
            createQuery(HibernateIdentityObjectCredential.findIdentityObjectCredentialByIOAndTypeNAme).
            setParameter("typeName", credential.getType().getName()).
            setParameter("identityObject", hibernateObject).uniqueResult();



         if (hibernateCredential == null)
         {
            return false;
         }

         // Handle generic impl

         Object value = null;

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String && hibernateCredential.getTextValue() != null)
         {
            return value.toString().equals(hibernateCredential.getTextValue());
         }
         else if (value instanceof byte[] && hibernateCredential.getBinaryValue() != null)
         {
            return Arrays.equals((byte[])value, hibernateCredential.getBinaryValue());
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential

         if (hibernateCredentialType == null)
         {
            throw new IllegalStateException("Credential type not present in this store: " + credential.getType().getName());
         }

         HibernateIdentityObjectCredential hibernateCredential = hibernateObject.getCredential(credential.getType());

         if (hibernateCredential == null)
         {
            hibernateCredential = new HibernateIdentityObjectCredential();
            hibernateCredential.setType(hibernateCredentialType);
            hibernateObject.addCredential(hibernateCredential);
         }


         Object value = null;

         // Handle generic impl

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String)
         {
            hibernateCredential.setTextValue(value.toString());
         }
         else if (value instanceof byte[])
         {
            hibernateCredential.setBinaryValue((byte[])value);
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }
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.