Project

General

Profile

« Previous | Next » 

Revision 9009

include person's full name in the JWT returned from /token

View differences:

src/edu/ucsb/nceas/metacat/restservice/v1/MNResourceHandler.java
67 67
import org.dataone.service.types.v1.ObjectFormatIdentifier;
68 68
import org.dataone.service.types.v1.ObjectList;
69 69
import org.dataone.service.types.v1.Permission;
70
import org.dataone.service.types.v1.Person;
70 71
import org.dataone.service.types.v1.SystemMetadata;
71 72
import org.dataone.service.types.v1_1.QueryEngineDescription;
72 73
import org.dataone.service.types.v1_1.QueryEngineList;
......
469 470
		
470 471
		if (this.session != null) {
471 472
			String userId = this.session.getSubject().getValue();
472

  
473
			String fullName = null;
474
			try {
475
				Person person = this.session.getSubjectInfo().getPerson(0);
476
				fullName = person.getGivenName(0) + " " + person.getFamilyName();
477
			} catch (Exception e) {
478
				logMetacat.warn(e.getMessage(), e);
479
			}
473 480
			String token = null;
474
			token = TokenGenerator.getJWT(userId);
481
			token = TokenGenerator.getJWT(userId, fullName);
475 482
			
476 483
			response.setStatus(200);
477 484
			response.setContentType("text/plain");
src/edu/ucsb/nceas/metacat/restservice/v2/MNResourceHandler.java
64 64
import org.dataone.service.types.v1.ObjectFormatIdentifier;
65 65
import org.dataone.service.types.v1.ObjectList;
66 66
import org.dataone.service.types.v1.Permission;
67
import org.dataone.service.types.v1.Person;
67 68
import org.dataone.service.types.v1_1.QueryEngineDescription;
68 69
import org.dataone.service.types.v1_1.QueryEngineList;
69 70
import org.dataone.service.types.v2.Log;
......
754 755
		
755 756
		if (this.session != null) {
756 757
			String userId = this.session.getSubject().getValue();
757

  
758
			String fullName = null;
759
			try {
760
				Person person = this.session.getSubjectInfo().getPerson(0);
761
				fullName = person.getGivenName(0) + " " + person.getFamilyName();
762
			} catch (Exception e) {
763
				logMetacat.warn(e.getMessage(), e);
764
			}
765
			
758 766
			String token = null;
759
			token = TokenGenerator.getJWT(userId);
767
			token = TokenGenerator.getJWT(userId, fullName);
760 768
			
761 769
			response.setStatus(200);
762 770
			response.setContentType("text/plain");

Also available in: Unified diff