Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Attempting to add an "external subject" with Grouper REST API

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Attempting to add an "external subject" with Grouper REST API


Chronological Thread 
  • From: Chris Hyzer <>
  • To: Keith Hazelton <>, "" <>
  • Subject: RE: [grouper-users] Attempting to add an "external subject" with Grouper REST API
  • Date: Fri, 26 Oct 2012 18:46:01 +0000
  • Accept-language: en-US

Ok, with poster, you need to set “Content to send”, “Body from parameters”.  Then it will work.

 

Yes, to enable external subjects, set this in the grouper.properties, and maybe other things, see whats there and what you want to send (and media.properties too in UI)

 

# grouper can auto create a jdbc2 source for the external subjects

externalSubjects.autoCreateSource = true

 

 

Thanks,

Chris

 

From: [mailto:] On Behalf Of Keith Hazelton
Sent: Friday, October 26, 2012 2:41 PM
To:
Subject: Re: [grouper-users] Attempting to add an "external subject" with Grouper REST API

 

On Oct 26, 2012, at 13:10:59, Chris Hyzer wrote:



Can you send that through a proxy and get the XML/JSON or whatever that is being sent?

 

I'm trying to follow the example in your earlier email:

 

e.g.

 

POST /grouper-ws/servicesRest/v2_1_001/groups/aStem%3AaGroup/members HTTP/1.1

 

wsLiteObjectType=WsRestAddMemberLiteRequest&subjectId=external_user_id_here&groupName=aStem%3AaGroup&addExternalSubjectIfNotFound=T

 

I POSTed the following (with everything on the URL as parameters, so there was no xml or json or anything):

 

 

I got a 500 error back "Cant find source with id: 'grouperExternal'":

 

{"WsAddMemberLiteResult":{"responseMetadata":{"millis":"77","serverVersion":"2.1.2"},"resultMetadata":{"resultCode":"EXCEPTION","resultMessage":"There were 0 successes and 1 failures of users added to the group.edu.internet2.middleware.subject.SourceUnavailableException: Cant find source with id: 'grouperExternal', Possible source id's: 'g:gsa', 'grouperEntities', 'jdbc', 'g:isa', \n\tat edu.internet2.middleware.grouper.subj.SourcesXmlResolver.getSource(SourcesXmlResolver.java:434)\n\tat edu.internet2.middleware.grouper.subj.SourcesXmlResolver.findByIdOrIdentifier(SourcesXmlResolver.java:542)\n\tat edu.internet2.middleware.grouper.subj.CachingResolver.findByIdOrIdentifier(CachingResolver.java:391)\n\tat  



 

Or you could try to log on the server:

 

 

Otherwise, its hard to know how to help…

 

Thanks,

Chris

 

From:  [] On Behalf Of Keith Hazelton
Sent: Friday, October 26, 2012 1:23 PM
To: 
Subject: Re: [grouper-users] Attempting to add an "external subject" with Grouper REST API

 

Thanks, but I still don't have something quite right. Here's a screen shot from Poster       --Keith

 

<image001.png>

 

On Oct 26, 2012, at 11:58:49, Chris Hyzer wrote:




There isn’t comprehensive WS support for external subjects in Grouper.  This part is mainly so that Groupers can sync to other Groupers.

 

So make a group of external users somewhere, send a WS call to add a member to the group by EPPN or whatever, and set that flag to T, and it will add the external user.  They could still login to the UI to register their personal information if you need it (that part isn’t part of the WS).

 

See the samples for addMember:

 

e.g.

 

POST /grouper-ws/servicesRest/v2_1_001/groups/aStem%3AaGroup/members HTTP/1.1

 

wsLiteObjectType=WsRestAddMemberLiteRequest&subjectId=external_user_id_here&groupName=aStem%3AaGroup&addExternalSubjectIfNotFound=T

 

 

 

 

Thanks,

Chris

 

-----Original Message-----
From:  [] On Behalf Of Keith Hazelton
Sent: Friday, October 26, 2012 12:41 PM
To: 
Subject: [grouper-users] Attempting to add an "external subject" with Grouper REST API

 

I want to put an external subject into a Grouper group using the RESTful web services. The subject is identified by a Bamboo Person ID, which is just a value like

urn:uuid:e700afeb-daee-4d49-99ed-1753127e8985

 

The Grouper WS documentation on Add Member (https://spaces.internet2.edu/display/Grouper/Add+Member) has the following under "Features"

 

"You can specify addExternalSubjectIfNotFound to T or F, if this is a search by id or identifier, with no source, or the external source, and the subject is not found, then add an external subject (if the user is allowed to do this)"

 

I'm using Firefox Poster for a proof of concept, and wondering what to put in the request body to set addExternalSubjectIfNotFound to "T".

 

     Advice welcome,   --Keith

 

_________________

I made a WAG, tried the following and got errors:

----------

content type: text/xml

POST

content:

<WsRestAddMemberLiteRequest>

  <groupName>458930f0-0716-11e2-892e-0800200c9a66:560d5c90-c23e-4e7c-903b-eab046b38cbc:xyz-1</groupName>

  <subjectId>urn:uuid:b386e4fd-38e6-4915-8c11-c9dc00963f3e</subjectId>

  <addExternalSubjectifNotFound>T</addExternalSubjectIfNotFound>

  <actAsSubjectId>GrouperSystem</actAsSubjectId>

</WsRestAddMemberLiteRequest>

----------

 

If I omit the line <addExternalSubjectifNotFound>T</addExternalSubjectIfNotFound>T</addExternalSubjectIfNotFound>

I get the expected "subject not found" error, since this subject is not available via any configured subject adapter

 

With that line in the request, I get this 500 error:

-----------

<WsRestResultProblem><resultMetadata><resultCode>EXCEPTION</resultCode><resultMessage>Problem with request:  uri: /grouper-ws/servicesRest/v2_1_000/groups, method: POST, decoded url strings: 0: &apos;v2_1_000&apos;, 1: &apos;groups&apos;,

com.thoughtworks.xstream.converters.ConversionException: addExternalSubjectifNotFound : addExternalSubjectifNotFound : addExternalSubjectifNotFound : addExternalSubjectifNotFound

---- Debugging information ----

message             : addExternalSubjectifNotFound : addExternalSubjectifNotFound

cause-exception     : com.thoughtworks.xstream.mapper.CannotResolveClassException

cause-message       : addExternalSubjectifNotFound : addExternalSubjectifNotFound

class               : edu.internet2.middleware.grouper.ws.rest.member.WsRestAddMemberLiteRequest

required-type       : edu.internet2.middleware.grouper.ws.rest.member.WsRestAddMemberLiteRequest

line number         : 4

-------------------------------

      at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:88)

      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:75)

      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)

      at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142)

      at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)

      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)

      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)

      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)

      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)

      at edu.internet2.middleware.grouper.ws.rest.contentType.WsRestRequestContentType$3.parseString(WsRestRequestContentType.java:159)

      at edu.internet2.middleware.grouper.ws.rest.GrouperRestServlet.service(GrouperRestServlet.java:183)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      at edu.internet2.middleware.grouper.ws.GrouperServiceJ2ee.doFilter(GrouperServiceJ2ee.java:653)

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

      at java.lang.Thread.run(Thread.java:679)

Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: addExternalSubjectifNotFound : addExternalSubjectifNotFound

      at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:62)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:86)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:87)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

      at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:52)

      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:318)

      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:196)

      at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:150)

      at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:81)

      ... 27 more

</resultMessage><success>F</success></resultMetadata><responseMetadata><resultWarnings></resultWarnings><millis>5</millis><serverVersion>2.1.2</serverVersion></responseMetadata></WsRestResultProblem>

----------

 

 

 

 




Archive powered by MHonArc 2.6.16.

Top of Page