Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Grouper Client - Issues Accessing Subject Attribute Values

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Grouper Client - Issues Accessing Subject Attribute Values


Chronological Thread 
  • From: "Hyzer, Chris" <>
  • To: "Hunter, Tim" <>, "" <>
  • Subject: RE: [grouper-users] Grouper Client - Issues Accessing Subject Attribute Values
  • Date: Wed, 17 Apr 2019 18:29:49 +0000

I added this to the WS faq:

 

Subject attributes can be exposed via web service

·         First off, you need to have the subject api configuration to get attribute from the DB / LDAP

·         Here is an example from a JDBC2 subject source

·          

# now you can count up from 0 to N of attributes for various cols.  The name is how to reference in subject.getAttribute()

subjectApi.source.pennperson.param.subjectAttributeCol0.value = pennname

 

# you can count up from 0 to N of attributes for various cols.  The name is how to reference in subject.getAttribute()

subjectApi.source.pennperson.param.subjectAttributeName0.value = PENNNAME

·          

·         You can test this from GSH

groovy:000> grouperSession = GrouperSession.startRootSession();

===> 4a29e140d3b346558c7c23ed996d1d8a,'GrouperSystem','application'

groovy:000> subject = SubjectFinder.findByIdOrIdentifier("mchyzer", true);

===> Subject id: 10021368, sourceId: pennperson, name: Chris Hyzer

groovy:000> subject.getAttributeValue("pennname")

===> mchyzer

·          

·          

·         Subject attributes are exposed via web service in the grouper-ws.properties

 

# subject attribute names to send back when a WsSubjectResult is sent, comma separated                                             

# e.g. name, netid                                                                                                                 

# default is none                                                                                                                  

ws.subject.result.attribute.names =

 

# subject result attribute names when extended data is requested (comma separated)                                                 

# default is name, description                                                                                                     

# note, these will be in addition to ws.subject.result.attribute.names                                                             

ws.subject.result.detail.attribute.names = PENNNAME

·          

·          

·         Then when a subject is returned, since ws.subject.result.attribute.names is blank, no custom attribute are returned by default

 

[mchyzer@flash pennGroupsClient-2.4.0]$ java -jar grouperClient.jar --operation=getSubjectsWs --subjectIdentifiers=mchyzer --debug=true

Reading resource: grouper.client.properties, from: /home/mchyzer/grouper/pennGroupsClient-2.4.0/grouper.client.properties

WebService: connecting as user: 'someuser'

WebService: connecting to URL: 'https://server.school.edu/grouperWs/servicesRest/v2_4_000/subjects'

 

################ REQUEST START (indented) ###############

 

POST /grouperWs/servicesRest/v2_4_000/subjects HTTP/1.1

Connection: close

Authorization: Basic xxxxxxxxxxxxxxxx

User-Agent: Jakarta Commons-HttpClient/3.1

Host: somehost.school.edu:-1

Content-Length: 171

Content-Type: text/xml; charset=UTF-8

 

<WsRestGetSubjectsRequest>

  <wsSubjectLookups>

    <WsSubjectLookup>

      <subjectIdentifier>mchyzer</subjectIdentifier>

    </WsSubjectLookup>

  </wsSubjectLookups>

</WsRestGetSubjectsRequest>

 

################ REQUEST END ###############

 

 

 

################ RESPONSE START (indented) ###############

 

HTTP/1.1 200 OK

Date: Wed, 17 Apr 2019 18:12:37 GMT

Set-Cookie: JSESSIONID=xxxxxxxxxxxx; HttpOnly

X-Grouper-resultCode: SUCCESS

X-Grouper-success: T

X-Grouper-resultCode2: NONE

Content-Type: application/xml;charset=UTF-8

Vary: Accept-Encoding

Connection: close

Transfer-Encoding: chunked

 

<WsGetSubjectsResults>

  <wsSubjects>

    <WsSubject>

      <identifierLookup>mchyzer</identifierLookup>

      <resultCode>SUCCESS</resultCode>

      <success>T</success>

      <id>10021368</id>

      <name>Chris Hyzer</name>

      <sourceId>pennperson</sourceId>

    </WsSubject>

  </wsSubjects>

  <resultMetadata>

    <resultCode>SUCCESS</resultCode>

    <resultMessage>Queried 1 subjects</resultMessage>

    <success>T</success>

  </resultMetadata>

  <responseMetadata>

    <resultWarnings></resultWarnings>

    <millis>11</millis>

    <serverVersion>2.4.0</serverVersion>

  </responseMetadata>

</WsGetSubjectsResults>

 

################ RESPONSE END ###############

 

 

Output template: Index: ${index}: success: ${success}, code: ${wsSubject.resultCode}, subject: ${wsSubject.id}, available variables: wsGetSubjectsResults, grouperClientUtils, index, wsSubject, wsGroup, success

Index: 0: success: T, code: SUCCESS, subject: 10021368

Elapsed time: 957ms

[mchyzer@flash pennGroupsClient-2.4.0]$

·          

·          

·         If you request the subject detail (attrs in ws.subject.result.detail.attribute.name), then they will be returned

 

[mchyzer@flash pennGroupsClient-2.4.0]$ java -jar grouperClient.jar --operation=getSubjectsWs --subjectIdentifiers=mchyzer --debug=true --includeSubjectDetail=true

Reading resource: grouper.client.properties, from: /home/mchyzer/grouper/pennGroupsClient-2.4.0/grouper.client.properties

WebService: connecting as user: 'user'

WebService: connecting to URL: 'https://server.school.edu/grouperWs/servicesRest/v2_4_000/subjects'

 

################ REQUEST START (indented) ###############

 

POST /grouperWs/servicesRest/v2_4_000/subjects HTTP/1.1

Connection: close

Authorization: Basic xxxxxxxxxxxxxxxx

User-Agent: Jakarta Commons-HttpClient/3.1

Host: fastprod-medium-a-01.apps.upenn.edu:-1

Content-Length: 217

Content-Type: text/xml; charset=UTF-8

 

<WsRestGetSubjectsRequest>

  <includeSubjectDetail>T</includeSubjectDetail>

  <wsSubjectLookups>

    <WsSubjectLookup>

      <subjectIdentifier>mchyzer</subjectIdentifier>

    </WsSubjectLookup>

  </wsSubjectLookups>

</WsRestGetSubjectsRequest>

 

################ REQUEST END ###############

 

 

 

################ RESPONSE START (indented) ###############

 

HTTP/1.1 200 OK

Date: Wed, 17 Apr 2019 18:16:55 GMT

Set-Cookie: JSESSIONID=xxxxxxxxxxxx; HttpOnly

X-Grouper-resultCode: SUCCESS

X-Grouper-success: T

X-Grouper-resultCode2: NONE

Content-Type: application/xml;charset=UTF-8

Vary: Accept-Encoding

Connection: close

Transfer-Encoding: chunked

 

<WsGetSubjectsResults>

  <subjectAttributeNames>

    <string>name</string>

    <string>description</string>

    <string>PENNNAME</string>

    <string>EMAIL</string>

  </subjectAttributeNames>

  <wsSubjects>

    <WsSubject>

      <identifierLookup>mchyzer</identifierLookup>

      <resultCode>SUCCESS</resultCode>

      <success>T</success>

      <id>10021368</id>

      <name>Chris Hyzer</name>

      <sourceId>pennperson</sourceId>

      <attributeValues>

        <string>Chris Hyzer</string>

        <string>Chris Hyzer (mchyzer, 10021368) (active) Staff - Isc-applications & Information Services - Application Architect (also: Alumni)</string>

        <string>mchyzer</string>

        <string></string>

      </attributeValues>

    </WsSubject>

  </wsSubjects>

  <resultMetadata>

    <resultCode>SUCCESS</resultCode>

    <resultMessage>Queried 1 subjects</resultMessage>

    <success>T</success>

  </resultMetadata>

  <responseMetadata>

    <resultWarnings></resultWarnings>

    <millis>121</millis>

    <serverVersion>2.4.0</serverVersion>

  </responseMetadata>

</WsGetSubjectsResults>

 

################ RESPONSE END ###############

 

 

Output template: Index: ${index}: success: ${success}, code: ${wsSubject.resultCode}, subject: ${wsSubject.id}, available variables: wsGetSubjectsResults, grouperClientUtils, index, wsSubject, wsGroup, success

Index: 0: success: T, code: SUCCESS, subject: 10021368

Elapsed time: 1106ms

[mchyzer@flash pennGroupsClient-2.4.0]$

·          

·          

·         Or you can request individual attributes

 

 

[mchyzer@flash pennGroupsClient-2.4.0]$ java -jar grouperClient.jar --operation=getSubjectsWs --subjectIdentifiers=mchyzer --debug=true --subjectAttributeNames=PENNNAME

Reading resource: grouper.client.properties, from: /home/mchyzer/grouper/pennGroupsClient-2.4.0/grouper.client.properties

WebService: connecting as user: 'user'

WebService: connecting to URL: 'https://server.school.edu/grouperWs/servicesRest/v2_4_000/subjects'

 

################ REQUEST START (indented) ###############

 

POST /grouperWs/servicesRest/v2_4_000/subjects HTTP/1.1

Connection: close

Authorization: Basic xxxxxxxxxxxxxxxx

User-Agent: Jakarta Commons-HttpClient/3.1

Host: fastprod-medium-a-01.apps.upenn.edu:-1

Content-Length: 243

Content-Type: text/xml; charset=UTF-8

 

<WsRestGetSubjectsRequest>

  <subjectAttributeNames>

    <string>PENNNAME</string>

  </subjectAttributeNames>

  <wsSubjectLookups>

    <WsSubjectLookup>

      <subjectIdentifier>mchyzer</subjectIdentifier>

    </WsSubjectLookup>

  </wsSubjectLookups>

</WsRestGetSubjectsRequest>

 

################ REQUEST END ###############

 

 

 

################ RESPONSE START (indented) ###############

 

HTTP/1.1 200 OK

Date: Wed, 17 Apr 2019 18:26:29 GMT

Set-Cookie: JSESSIONID=xxxxxxxxxxxx; HttpOnly

X-Grouper-resultCode: SUCCESS

X-Grouper-success: T

X-Grouper-resultCode2: NONE

Content-Type: application/xml;charset=UTF-8

Vary: Accept-Encoding

Connection: close

Transfer-Encoding: chunked

 

<WsGetSubjectsResults>

  <subjectAttributeNames>

    <string>PENNNAME</string>

  </subjectAttributeNames>

  <wsSubjects>

    <WsSubject>

      <identifierLookup>mchyzer</identifierLookup>

      <resultCode>SUCCESS</resultCode>

      <success>T</success>

      <id>10021368</id>

      <name>Chris Hyzer</name>

      <sourceId>pennperson</sourceId>

      <attributeValues>

        <string>mchyzer</string>

      </attributeValues>

    </WsSubject>

  </wsSubjects>

  <resultMetadata>

    <resultCode>SUCCESS</resultCode>

    <resultMessage>Queried 1 subjects</resultMessage>

    <success>T</success>

  </resultMetadata>

  <responseMetadata>

    <resultWarnings></resultWarnings>

    <millis>207</millis>

    <serverVersion>2.4.0</serverVersion>

  </responseMetadata>

</WsGetSubjectsResults>

 

################ RESPONSE END ###############

 

 

Output template: Index: ${index}: success: ${success}, code: ${wsSubject.resultCode}, subject: ${wsSubject.id}, available variables: wsGetSubjectsResults, grouperClientUtils, index, wsSubject, wsGroup, success

Index: 0: success: T, code: SUCCESS, subject: 10021368

Elapsed time: 1180ms

[mchyzer@flash pennGroupsClient-2.4.0]$

·         dsf

 

 

From: <> On Behalf Of Hunter, Tim
Sent: Saturday, April 13, 2019 2:09 PM
To:
Subject: Re: [grouper-users] Grouper Client - Issues Accessing Subject Attribute Values

 

Hello again,

 

I'm still waiting to hear a reply regarding the issues with the Grouper Client and getting the Subject Attributes data. Could I please get a update regarding this?

 

-Tim Hunter


From: Hunter, Tim
Sent: Thursday, April 4, 2019 2:07:35 PM
To:
Subject: Grouper Client - Issues Accessing Subject Attribute Values

 

Greetings,

 

I'm using the Grouper software you provide. I've been struggling with the Grouper Client's ability to access the values of Subject Attributes. I'm using a Java application to call the commands provided through the grouperClient library and have been trying to use the .getAttributeValues() method on WsSubject objects however this has only been returning nulls. Looking at the documentation it states something about the config properties via the line:

if attributes are being sent back per config in the grouper.properties, this is attribute0 value, this is extended subject data

 

I am not sure how I am supposed to go about setting this configuration since I've been unable to find clear documentation on the matter. I am using the example data that comes with the Grouper installation for testing. Can I get clarification on how I'm supposed to use this method and what other setup may be required to get the additional data from my Subject Attributes?

 

-Tim Hunter




Archive powered by MHonArc 2.6.19.

Top of Page