// Path: src/main/java/com/hoserdude/toboot/domain/User.java
// @Entity
// @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")})
// public class User implements UserDetails {
// 
//     @Id
//     @GeneratedValue(strategy= GenerationType.AUTO)
//     private Long id;
// 
//     /**
//      * See unique constraint in Table definition
//      */
//     @Column
//     private String userId;
// 
//     @Column
//     private String fullName;
// 
//     @Column
//     private String email;
// 
//     public User() {}
// 
//     public User(String userId, String fullName, String email) {
//         this.userId = userId;
//         this.fullName = fullName;
//         this.email = email;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public void setUserId(String userId) {
//         this.userId = userId;
//     }
// 
//     public String getFullName() {
//         return fullName;
//     }
// 
//     public void setFullName(String fullName) {
//         this.fullName = fullName;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// 
//     // Everything down here is to be cool with Spring Security Interface we are implementing.
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return AuthorityUtils.createAuthorityList("ROLE_USER");
//     }
// 
//     /**
//      * Since we use OpenId, we never store this.
//      * @return
//      */
//     @Override
//     public String getPassword() {
//         return "";
//     }
// 
//     /**
//      * We're using the unique ID from OpenID
//      * @return
//      */
//     @Override
//     public String getUsername() {
//         return this.userId;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isEnabled() {
//         return true;
//     }
// 
// }
// 
// Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java
// @Repository
// public interface UserRepository extends CrudRepository<User, Long> {
//     User findByEmail(String email);
// }


import com.hoserdude.toboot.domain.User;
import com.hoserdude.toboot.domainRepository.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.openid.OpenIDAttribute;
import org.springframework.security.openid.OpenIDAuthenticationToken;
import org.springframework.stereotype.Service;
import java.util.List;
        final List<OpenIDAttribute> attributes = token.getAttributes();
        String emailAddress = null;
        String fullName = null;
        String firstName = null;
        String lastName = null;
        //Grab their name and email
        for (OpenIDAttribute attribute : attributes) {
            String name = attribute.getName();
            if (name.equals("email")) {
                if (attribute.getCount() == 1) {
                    emailAddress = attribute.getValues().get(0);
                }
            }
            if (name.equals("fullname")) {
                if (attribute.getCount() == 1) {
                    fullName = attribute.getValues().get(0);
                }
            }
            if (name.equals("firstname")) {
                if (attribute.getCount() == 1) {
                    firstName = attribute.getValues().get(0);
                }
            }
            if (name.equals("lastname")) {
                if (attribute.getCount() == 1) {
                    lastName = attribute.getValues().get(0);
                }
            }
        }
        if (emailAddress != null) {
// Path: src/main/java/com/hoserdude/toboot/domain/User.java
// @Entity
// @Table(name = "tb_user", uniqueConstraints = {@UniqueConstraint(name = "UK_User_userId", columnNames = "userId")})
// public class User implements UserDetails {
// 
//     @Id
//     @GeneratedValue(strategy= GenerationType.AUTO)
//     private Long id;
// 
//     /**
//      * See unique constraint in Table definition
//      */
//     @Column
//     private String userId;
// 
//     @Column
//     private String fullName;
// 
//     @Column
//     private String email;
// 
//     public User() {}
// 
//     public User(String userId, String fullName, String email) {
//         this.userId = userId;
//         this.fullName = fullName;
//         this.email = email;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public void setUserId(String userId) {
//         this.userId = userId;
//     }
// 
//     public String getFullName() {
//         return fullName;
//     }
// 
//     public void setFullName(String fullName) {
//         this.fullName = fullName;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// 
//     // Everything down here is to be cool with Spring Security Interface we are implementing.
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return AuthorityUtils.createAuthorityList("ROLE_USER");
//     }
// 
//     /**
//      * Since we use OpenId, we never store this.
//      * @return
//      */
//     @Override
//     public String getPassword() {
//         return "";
//     }
// 
//     /**
//      * We're using the unique ID from OpenID
//      * @return
//      */
//     @Override
//     public String getUsername() {
//         return this.userId;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isEnabled() {
//         return true;
//     }
// 
// }
// 
// Path: src/main/java/com/hoserdude/toboot/domainRepository/UserRepository.java
// @Repository
// public interface UserRepository extends CrudRepository<User, Long> {
//     User findByEmail(String email);
// }


// Path: src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java
import com.hoserdude.toboot.domain.User;
import com.hoserdude.toboot.domainRepository.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.openid.OpenIDAttribute;
import org.springframework.security.openid.OpenIDAuthenticationToken;
import org.springframework.stereotype.Service;
import java.util.List;

        final List<OpenIDAttribute> attributes = token.getAttributes();
        String emailAddress = null;
        String fullName = null;
        String firstName = null;
        String lastName = null;
        //Grab their name and email
        for (OpenIDAttribute attribute : attributes) {
            String name = attribute.getName();
            if (name.equals("email")) {
                if (attribute.getCount() == 1) {
                    emailAddress = attribute.getValues().get(0);
                }
            }
            if (name.equals("fullname")) {
                if (attribute.getCount() == 1) {
                    fullName = attribute.getValues().get(0);
                }
            }
            if (name.equals("firstname")) {
                if (attribute.getCount() == 1) {
                    firstName = attribute.getValues().get(0);
                }
            }
            if (name.equals("lastname")) {
                if (attribute.getCount() == 1) {
                    lastName = attribute.getValues().get(0);
                }
            }
        }
        if (emailAddress != null) {
            User user = userRepository.findByEmail(emailAddress);