问题
NOTE Exact same issue as Tridion UGC comment shows author as null
When posting comments from the presentation website users are saved with ID null. This causes the next comment to show as posted from the first user who commented and also has ID null.
The cd core log file shows that the AnonymousPostClaimProcessor
is using the tracking id
.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_2151731a-97d2-4a90-800f-bee20074b970
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_2151731a-97d2-4a90-800f-bee20074b970, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_2151731a-97d2-4a90-800f-bee20074b970' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@74002515, thread: Thread-1
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={content-type=[Ljava.lang.String;@3582c132, connection=[Ljava.lang.String;@1b59d510, host=[Ljava.lang.String;@26b31b77, accept=[Ljava.lang.String;@38d0357a, content-length=[Ljava.lang.String;@6d66f9b9}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@39518cc, $orderby=[Ljava.lang.String;@318efaea, QUERY_STRING=[Ljava.lang.String;@21fb3211, $filter=[Ljava.lang.String;@72940b84, $expand=[Ljava.lang.String;@558041e0, $top=[Ljava.lang.String;@576504fa, $skip=[Ljava.lang.String;@2929e5e9}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=GET, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_546acbc8-a478-45cd-80fa-5d93bc10481d
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_08092308-7e3b-47c7-9524-79497daee2e2
DEBUG ClaimStore - put: uri=taf:session:attributes, value={Tridion.ContentDelivery.AmbientData.ClaimStore=Tridion.ContentDelivery.AmbientData.ClaimStore}
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
My ugc ambient cartridge is configured as follows:
<ClaimProcessorDefinitions>
<!-- Allows anonymous posts. Disable when using a login system. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:anonymous"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.AllowAnonymousPostClaimProcessor"
Description="Claim processor that allows an anonymous post.">
<RequestStart>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<!-- Post allowed by everyone. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByEveryoneClaimProcessor"
Description="Claim processor that allows a post.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
</ClaimProcessorDefinitions>
The ugc cartridge configuration for the cm ugc web service is the same, but does show the right ID.
It would be great when anyone can direct me to the right configuration files to verify.
EDIT 27/7
The ugc ambient cartridge configuration on the presentation cd ws is as follows, and has the AllowAnonymousPostClaimProcessor defined.
<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:ugc" Description="UGC cartridge."
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
<ClaimDefinitions>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed" Scope="REQUEST"
Description="A flag where a POST is allowed to the UGC OData entities."/>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user" Scope="REQUEST"
Description="The user posting to the OData service."/>
<ClaimDefinition Uri="taf:claim:tracking:internalcontactid" Scope="REQUEST"
Description="The Audience Manager internal contact id."/>
<ClaimDefinition Uri="taf:claim:tracking:updatedcontact:xml" Scope="REQUEST"
Description="The Audience Manager updated contact xml."/>
</ClaimDefinitions>
<ClaimProcessorDefinitions>
<!-- Allows anonymous posts. Disable when using a login system. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:anonymous"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.AllowAnonymousPostClaimProcessor"
Description="Claim processor that allows an anonymous post.">
<RequestStart>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<!-- Post allowed by owners. -->
<!--
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByOwnerClaimProcessor"
Description="Claim processor that determines if a post is allowed by checking if the user is the owner.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
-->
<!-- Post allowed by everyone. -->
<ClaimProcessorDefinition Uri="taf:claimprocessor:webservice:ugc:post"
ImplementationClass="com.tridion.ugc.odata.claimprocessor.PostAllowedByEveryoneClaimProcessor"
Description="Claim processor that allows a post.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:user"/>
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="taf:claim:contentdelivery:webservice:post:allowed"/>
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
</ClaimProcessorDefinitions>
</CartridgeDefinition>
And the POST log file as requested:
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@29578426, thread: Thread-6
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={expect=[Ljava.lang.String;@30a4effe, content-type=[Ljava.lang.String;@1c8825a5, host=[Ljava.lang.String;@2e5f8245, accept=[Ljava.lang.String;@6197cc, content-length=[Ljava.lang.String;@734d246}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@1cd8f55c, QUERY_STRING=[Ljava.lang.String;@67d479cf}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc\Comments, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc/Comments, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=POST, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_51f52143-1095-4585-9eb8-b01f95dff721
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_f409708f-4063-4eca-8c81-f140ba4a6568
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_f409708f-4063-4eca-8c81-f140ba4a6568
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_f409708f-4063-4eca-8c81-f140ba4a6568, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_f409708f-4063-4eca-8c81-f140ba4a6568' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ClaimStore - put: uri=taf:response:cookie:generation, value=true
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@2e893a4a, thread: Thread-6
DEBUG ClaimStore - put: uri=taf:request:uri, value=/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:full_url, value=http://staging:8080/odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:request:headers, value={expect=[Ljava.lang.String;@3351e824, content-type=[Ljava.lang.String;@465fadce, host=[Ljava.lang.String;@338bd37a, accept=[Ljava.lang.String;@20e90906, content-length=[Ljava.lang.String;@234f79cb}
DEBUG ClaimStore - put: uri=taf:request:cookies, value={ASP.NET_SessionId=wx00dumyccjnopshos2ucw4l}
DEBUG ClaimStore - put: uri=taf:request:parameters, value={CONTENT_TYPE=[Ljava.lang.String;@36c51089, QUERY_STRING=[Ljava.lang.String;@43c0ae76}
DEBUG ClaimStore - put: uri=taf:server:variables, value={REMOTE_USER=, PATH_TRANSLATED=C:\inetpub\staging_cd_webservices\odata.svc, SERVER_PORT=8080, SCRIPT_NAME=/odata.svc, REMOTE_ADDR=127.0.0.1, AUTH_TYPE=, SERVER_PROTOCOL=HTTP/1.1, REQUEST_METHOD=POST, DOCUMENT_ROOT=C:\inetpub\staging_cd_webservices, REMOTE_HOST=127.0.0.1, SERVER_NAME=staging, SECURE=false}
DEBUG ClaimStore - put: uri=taf:session:id, value=tridion_90269b03-0f48-4986-a607-ec04010a9161
DEBUG ClaimStore - put: uri=taf:tracking:id, value=tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163
DEBUG ClaimStore - put: uri=taf:session:attributes, value={Tridion.ContentDelivery.AmbientData.ClaimStore=Tridion.ContentDelivery.AmbientData.ClaimStore}
DEBUG AllowAnonymousPostClaimProcessor - No external user specified, using tracking id.
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:user, value=tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163
TRACE ODataInputParser - Parsing following queryString: /Comments
TRACE BasePostClaimProcessor - User ID: tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163, Request URI: /odata.svc/Comments
DEBUG PostAllowedByEveryoneClaimProcessor - Allowing user 'tridion_9a97ffcb-7c38-41b6-95dd-8bd6d564a163' to post on: /odata.svc/Comments
DEBUG ClaimStore - put: uri=taf:claim:contentdelivery:webservice:post:allowed, value=true
DEBUG ODataService - ODATA.NET: Inserting entity on path: Comments
DEBUG WebContext - setCurrentClaimStore: com.tridion.ambientdata.dotnet.DotNetClaimStore@2e893a4a, thread: Thread-2
TRACE ODataInputParser - Parsing following queryString: Comments
DEBUG WritableCommentEntryService - Parsing comment: {d:{"Id":0,"ItemPublicationId":11,"ItemId":361,"ItemType":64,"CreationDate":"\/Date(1343385654263+60)\/","LastModifiedDate":"\/Date(1343385654263+60)\/","User":{"Id":null,"Name":"John Doe","EmailAddress":"bla@bla.com","ExternalId":null},"Content":"sdfsdfsdf","Moderator":null,"ModeratedDate":null,"Score":0,"Status":0}}.
DEBUG UGCConfigurationLoader - Attempt loading default storage configuration file
DEBUG WritableCommentEntryService - Storing comment: Comment [commentId=0, content=sdfsdfsdf, itemPublicationId=11, itemId=361, itemType=64, author=com.tridion.storage.ugc.UGCUser@2537e19e, creationDate=Fri Jul 27 11:40:54 BST 2012, lastModifiedDate=Fri Jul 27 11:40:54 BST 2012, moderatedDate=null, moderator=null, score=0, status=0].
DEBUG JPACommentDAO - Add comment to storage: Comment [commentId=0, content=sdfsdfsdf, itemPublicationId=11, itemId=361, itemType=64, author=com.tridion.storage.ugc.UGCUser@2537e19e, creationDate=Fri Jul 27 11:40:54 BST 2012, lastModifiedDate=Fri Jul 27 11:40:54 BST 2012, moderatedDate=null, moderator=null, score=0, status=0].
DEBUG JPAUserDAO - Searching for user with id null in storage.
TRACE JPABaseDAO - [ActionTimer] Query List Result time: 10275376 nanoseconds (10.275376 milliseconds)
DEBUG JPAUserDAO - User already in storage. No need to create new one.
You can see at some point that the User Id is null, already when the Comment Data is posted.
来源:https://stackoverflow.com/questions/11674743/tridion-ugc-anonymous-users-saved-to-ugc-database-with-id-null