<commit_before>/*
 *  eXist Open Source Native XML Database
 *  Copyright (C) 2010 The eXist Project
 *  http://exist-db.org
 *  
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *  $Id$
 */
package org.exist.security.openid;

import java.util.HashMap;
import java.util.Map;

import org.exist.security.Realm;
import org.exist.security.User;
import org.exist.xmldb.XmldbURI;
import org.openid4java.discovery.Identifier;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class UserImpl implements User {

	Identifier  _identifier = null;
	
	public UserImpl(Identifier identifier) {
		_identifier = identifier;
	}

	@Override
	public void addGroup(String group) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void remGroup(String group) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setGroups(String[] groups) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String[] getGroups() {
		return new String[0];
	}

	@Override
	public boolean hasDbaRole() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int getUID() {
		return -1;
	}

	@Override
	public String getPrimaryGroup() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean hasGroup(String group) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setPassword(String passwd) {
	}

	@Override
	public void setHome(XmldbURI homeCollection) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public XmldbURI getHome() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean authenticate(Object credentials) {
		return false;
	}

	@Override
	public boolean isAuthenticated() {
		return (_identifier != null);
	}

	@Override
	public Realm getRealm() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setUID(int uid) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getPassword() {
		return null;
	}

	@Override
	public String getDigestPassword() {
		return null;
	}

	@Override
	public String getName() {
		return _identifier.getIdentifier();
	}

	private Map<String, Object> attributes = new HashMap<String, Object>();
	
	@Override
	public void setAttribute(String name, Object value) {
		attributes.put(name, value);
	}

	@Override
	public Object getAttribute(String name) {
		return attributes.get(name);
	}
}
<commit_msg>[ignore] OpenID user's name as firstname + " " + lastname if present<commit_after>/*
 *  eXist Open Source Native XML Database
 *  Copyright (C) 2010 The eXist Project
 *  http://exist-db.org
 *  
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *  $Id$
 */
package org.exist.security.openid;

import java.util.HashMap;
import java.util.Map;

import org.exist.security.Realm;
import org.exist.security.User;
import org.exist.xmldb.XmldbURI;
import org.openid4java.discovery.Identifier;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public class UserImpl implements User {

	Identifier  _identifier = null;
	
	public UserImpl(Identifier identifier) {
		_identifier = identifier;
	}

	@Override
	public void addGroup(String group) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void remGroup(String group) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setGroups(String[] groups) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String[] getGroups() {
		return new String[0];
	}

	@Override
	public boolean hasDbaRole() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int getUID() {
		return -1;
	}

	@Override
	public String getPrimaryGroup() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean hasGroup(String group) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setPassword(String passwd) {
	}

	@Override
	public void setHome(XmldbURI homeCollection) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public XmldbURI getHome() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean authenticate(Object credentials) {
		return false;
	}

	@Override
	public boolean isAuthenticated() {
		return (_identifier != null);
	}

	@Override
	public Realm getRealm() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setUID(int uid) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getPassword() {
		return null;
	}

	@Override
	public String getDigestPassword() {
		return null;
	}

	@Override
	public String getName() {
		String name = "";
		if (attributes.containsKey("firstname")) 
			name += attributes.get("firstname"); 
		if (attributes.containsKey("lastname"))
			if (name != "") name += " ";
			name += attributes.get("lastname");
		
		if (name == "") 
			return _identifier.getIdentifier();
		
		return name;
	}

	private Map<String, Object> attributes = new HashMap<String, Object>();
	
	@Override
	public void setAttribute(String name, Object value) {
		attributes.put(name, value);
	}

	@Override
	public Object getAttribute(String name) {
		return attributes.get(name);
	}
}

{'fraction_non_alphanumeric': 0.09691697191697192, 'fraction_numerical': 0.004884004884004884, 'mean_word_length': 3.5506944444444444, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3873676', 'n_tokens_mistral': 2136, 'n_tokens_neox': 1972, 'n_words': 681}