git commit: CXF-5923: Create sample to demonstrate usage of search extension with Lucene and Tika. Added CORS provider.

2014-09-08 Thread reta
Repository: cxf
Updated Branches:
  refs/heads/master f6b091154 -> 1b3f01b4f


CXF-5923: Create sample to demonstrate usage of search extension with Lucene 
and Tika. Added CORS provider.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1b3f01b4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1b3f01b4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1b3f01b4

Branch: refs/heads/master
Commit: 1b3f01b4f640beea1f1247416ad9891e615f816c
Parents: f6b0911
Author: reta 
Authored: Mon Sep 8 22:05:04 2014 -0400
Committer: reta 
Committed: Mon Sep 8 22:05:04 2014 -0400

--
 .../main/release/samples/jax_rs/search/pom.xml|  7 ++-
 .../java/demo/jaxrs/search/server/Catalog.java| 18 --
 .../java/demo/jaxrs/search/server/Server.java |  2 ++
 3 files changed, 16 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/1b3f01b4/distribution/src/main/release/samples/jax_rs/search/pom.xml
--
diff --git a/distribution/src/main/release/samples/jax_rs/search/pom.xml 
b/distribution/src/main/release/samples/jax_rs/search/pom.xml
index 9a9a1fa..05c1ef1 100644
--- a/distribution/src/main/release/samples/jax_rs/search/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/search/pom.xml
@@ -107,7 +107,12 @@
 org.apache.cxf
 cxf-rt-rs-extension-providers
 ${cxf.version}
-  
+ 
+
+org.apache.cxf
+cxf-rt-rs-security-cors
+${cxf.version}
+ 
 
 org.apache.lucene
 lucene-core

http://git-wip-us.apache.org/repos/asf/cxf/blob/1b3f01b4/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
--
diff --git 
a/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
 
b/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
index ead0cd0..d9cf249 100644
--- 
a/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
+++ 
b/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
@@ -62,6 +62,7 @@ import org.apache.cxf.jaxrs.ext.search.SearchContext;
 import org.apache.cxf.jaxrs.ext.search.lucene.LuceneQueryVisitor;
 import org.apache.cxf.jaxrs.ext.search.tika.LuceneDocumentMetadata;
 import org.apache.cxf.jaxrs.ext.search.tika.TikaLuceneContentExtractor;
+import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
@@ -84,8 +85,6 @@ import org.apache.tika.parser.pdf.PDFParser;
 
 @Path("/catalog")
 public class Catalog {
-private static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = 
"Access-Control-Allow-Origin";
-
 private final TikaLuceneContentExtractor extractor = new 
TikaLuceneContentExtractor(new PDFParser());
 private final Directory directory = new RAMDirectory();
 private final Analyzer analyzer = new 
StandardAnalyzer(Version.LUCENE_4_9);
@@ -101,6 +100,7 @@ public class Catalog {
 }
 
 @POST
+@CrossOriginResourceSharing(allowAllOrigins = true)
 @Consumes("multipart/form-data")
 public void addBook(@Suspended final AsyncResponse response, @Context 
final UriInfo uri, 
 final MultipartBody body)  {
@@ -119,29 +119,26 @@ public class Catalog {
 
 try {
 if (exists(source)) {
-
response.resume(Response.status(Status.CONFLICT)
-
.header(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*").build());
+
response.resume(Response.status(Status.CONFLICT).build());
 return;
 }
 
 final byte[] content = 
IOUtils.readBytesFromStream(handler.getInputStream());
 storeAndIndex(metadata, content);
 } catch (final Exception ex) {
-response.resume(Response.serverError()
-
.header(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*").build());  
+response.resume(Response.serverError().build());  
 } 
 
 if (response.isSuspended()) {
 response.resume(Respons

git commit: Update some plugin versions

2014-09-08 Thread dkulp
Repository: cxf
Updated Branches:
  refs/heads/master 384ad7543 -> f6b091154


Update some plugin versions


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f6b09115
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f6b09115
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f6b09115

Branch: refs/heads/master
Commit: f6b091154ecd71e8d2ee98106d2c11dd1adc55fa
Parents: 384ad75
Author: Daniel Kulp 
Authored: Mon Sep 8 13:49:45 2014 -0400
Committer: Daniel Kulp 
Committed: Mon Sep 8 13:49:45 2014 -0400

--
 parent/pom.xml |  2 +-
 pom.xml| 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/f6b09115/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index 6c659bf..783cdfc 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -326,7 +326,7 @@
 
 org.apache.maven.plugins
 maven-pmd-plugin
-3.1
+3.2
 
 
 org.apache.cxf.build-utils

http://git-wip-us.apache.org/repos/asf/cxf/blob/f6b09115/pom.xml
--
diff --git a/pom.xml b/pom.xml
index dca31d3..66486ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -414,7 +414,7 @@
 
 org.codehaus.mojo
 build-helper-maven-plugin
-1.8
+1.9.1
 
 
 org.codehaus.mojo
@@ -434,12 +434,12 @@
 
 org.apache.maven.plugins
 maven-war-plugin
-2.2
+2.4
 
 
 org.apache.maven.plugins
 maven-install-plugin
-2.5.1
+2.5.2
 
 
 org.apache.maven.plugins
@@ -477,7 +477,7 @@
 
 org.apache.maven.plugins
 maven-source-plugin
-2.2.1
+2.3
 
 
 org.apache.maven.plugins
@@ -522,7 +522,7 @@
 
 org.apache.maven.plugins
 maven-jar-plugin
-2.4
+2.5
 
 
 org.apache.maven.plugins
@@ -535,7 +535,7 @@
 
 org.apache.maven.plugins
 maven-assembly-plugin
-2.4
+2.4.1
 
 
 org.apache.maven.plugins
@@ -545,12 +545,12 @@
 
 org.apache.maven.plugins
 maven-deploy-plugin
-2.8.1
+2.8.2
 
 
 org.apache.maven.plugins
 maven-surefire-report-plugin
-2.16
+2.17
 
 
 org.apache.maven.plugins
@@ -560,7 +560,7 @@
 
 org.apache.maven.plugins
 maven-plugin-plugin
-3.2
+3.3
 
 
 org.apache.maven.plugins
@@ -577,7 +577,7 @@
 
 org.apache.rat
 apache-rat-plugin
-0.10
+0.11
 
 350
 false
@@ -599,7 +599,7 @@
 
 org.apache.maven.plugins
 maven-site-plugin
-3.3
+3.4
 
 true
 
false



git commit: Support pass-through Kerberos use-case

2014-09-08 Thread coheigea
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.1.x-fixes 3f0cb5be4 -> 1a1d776bd


Support pass-through Kerberos use-case

Conflicts:

services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
services/idp/src/main/resources/restContextKerberos.xml


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/1a1d776b
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/1a1d776b
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/1a1d776b

Branch: refs/heads/1.1.x-fixes
Commit: 1a1d776bd9094a47aeb8f725d51b2462b4dffad4
Parents: 3f0cb5b
Author: Colm O hEigeartaigh 
Authored: Mon Sep 8 15:49:00 2014 +0100
Committer: Colm O hEigeartaigh 
Committed: Mon Sep 8 16:41:43 2014 +0100

--
 .../service/idp/STSAuthenticationProvider.java  | 123 +--
 .../idp/kerberos/PassThroughKerberosClient.java |  70 +++
 .../webapp/WEB-INF/security-config-kerberos.xml |   7 +-
 3 files changed, 157 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a1d776b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
--
diff --git 
a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
 
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
index 562c9e7..0fc60fb 100644
--- 
a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
+++ 
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
@@ -39,10 +39,12 @@ import org.apache.cxf.fediz.core.Claim;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.service.idp.kerberos.KerberosServiceRequestToken;
 import org.apache.cxf.fediz.service.idp.kerberos.KerberosTokenValidator;
+import org.apache.cxf.fediz.service.idp.kerberos.PassThroughKerberosClient;
 //import org.apache.cxf.transport.http.HTTPConduit;
 //import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
+import org.apache.ws.security.SAMLTokenPrincipal;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.message.token.KerberosServiceContext;
 import org.apache.ws.security.saml.ext.AssertionWrapper;
@@ -98,6 +100,8 @@ public class STSAuthenticationProvider implements 
AuthenticationProvider {
 
 private boolean kerberosUsernameServiceNameForm;
 
+private boolean requireDelegation;
+
 
 @Override
 public Authentication authenticate(Authentication authentication) throws 
AuthenticationException {
@@ -121,47 +125,22 @@ public class STSAuthenticationProvider implements 
AuthenticationProvider {
 
 Principal kerberosPrincipal = null;
 if (authentication instanceof KerberosServiceRequestToken) {
-
-if (kerberosTokenValidator == null) {
-LOG.error("KerberosTokenValidator must be configured to 
support kerberos");
-return null;
-}
-KerberosServiceContext kerberosContext;
-try {
-kerberosContext = 
-
kerberosTokenValidator.validate((KerberosServiceRequestToken)authentication);
-if (kerberosContext != null) {
-GSSCredential delegatedCredential = 
kerberosContext.getDelegationCredential();
-if (delegatedCredential != null) {
-
sts.getProperties().put(SecurityConstants.DELEGATED_CREDENTIAL, 
-delegatedCredential);
-
sts.getProperties().put(SecurityConstants.KERBEROS_USE_CREDENTIAL_DELEGATION, 
"true");
-}
-kerberosPrincipal = kerberosContext.getPrincipal();
+// 
+// If delegation is required then validate the received token + 
store the
+// Delegated Credential so that we can retrieve a new kerberos 
token for the
+// STS with it. If delegation is not required, then we just get 
the received
+// token + pass it to the STS
+//
+if (requireDelegation) {
+kerberosPrincipal = 
+
validateKerberosToken((KerberosServiceRequestToken)authentication, sts);
+if (kerberosPrincipal == null) {
+return null;
 }
-} catch (LoginException ex) {
-LOG.info("Failed to authenticate user '" + 
authentication.getName() + "'", ex);
-return null;
- 

git commit: Support pass-through Kerberos use-case

2014-09-08 Thread coheigea
Repository: cxf-fediz
Updated Branches:
  refs/heads/master bb7d7488b -> fd46b5bf3


Support pass-through Kerberos use-case


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/fd46b5bf
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/fd46b5bf
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/fd46b5bf

Branch: refs/heads/master
Commit: fd46b5bf3711723feaf09434b4463817f7821933
Parents: bb7d748
Author: Colm O hEigeartaigh 
Authored: Mon Sep 8 15:49:00 2014 +0100
Committer: Colm O hEigeartaigh 
Committed: Mon Sep 8 15:49:00 2014 +0100

--
 .../service/idp/STSAuthenticationProvider.java  | 124 +--
 .../idp/kerberos/PassThroughKerberosClient.java |  71 +++
 .../src/main/resources/restContextKerberos.xml  |   6 +-
 .../webapp/WEB-INF/security-config-kerberos.xml |   7 +-
 4 files changed, 163 insertions(+), 45 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/fd46b5bf/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
--
diff --git 
a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
 
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
index bf96aff..af76d64 100644
--- 
a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
+++ 
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/STSAuthenticationProvider.java
@@ -39,11 +39,13 @@ import org.apache.cxf.fediz.core.Claim;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.service.idp.kerberos.KerberosServiceRequestToken;
 import org.apache.cxf.fediz.service.idp.kerberos.KerberosTokenValidator;
+import org.apache.cxf.fediz.service.idp.kerberos.PassThroughKerberosClient;
 //import org.apache.cxf.transport.http.HTTPConduit;
 //import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.SecurityToken;
 import org.apache.wss4j.common.kerberos.KerberosServiceContext;
+import org.apache.wss4j.common.principal.SAMLTokenPrincipalImpl;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
 import org.apache.wss4j.dom.WSConstants;
 import org.ietf.jgss.GSSContext;
@@ -105,6 +107,8 @@ public class STSAuthenticationProvider implements 
AuthenticationProvider {
 
 private boolean kerberosUsernameServiceNameForm;
 
+private boolean requireDelegation;
+
 
 @Override
 public Authentication authenticate(Authentication authentication) throws 
AuthenticationException {
@@ -124,47 +128,22 @@ public class STSAuthenticationProvider implements 
AuthenticationProvider {
 
 Principal kerberosPrincipal = null;
 if (authentication instanceof KerberosServiceRequestToken) {
-
-if (kerberosTokenValidator == null) {
-LOG.error("KerberosTokenValidator must be configured to 
support kerberos");
-return null;
-}
-KerberosServiceContext kerberosContext;
-try {
-kerberosContext = 
-
kerberosTokenValidator.validate((KerberosServiceRequestToken)authentication);
-if (kerberosContext != null) {
-GSSCredential delegatedCredential = 
kerberosContext.getDelegationCredential();
-if (delegatedCredential != null) {
-
sts.getProperties().put(SecurityConstants.DELEGATED_CREDENTIAL, 
-delegatedCredential);
-
sts.getProperties().put(SecurityConstants.KERBEROS_USE_CREDENTIAL_DELEGATION, 
"true");
-}
-kerberosPrincipal = kerberosContext.getPrincipal();
+// 
+// If delegation is required then validate the received token + 
store the
+// Delegated Credential so that we can retrieve a new kerberos 
token for the
+// STS with it. If delegation is not required, then we just get 
the received
+// token + pass it to the STS
+//
+if (requireDelegation) {
+kerberosPrincipal = 
+
validateKerberosToken((KerberosServiceRequestToken)authentication, sts);
+if (kerberosPrincipal == null) {
+return null;
 }
-} catch (LoginException ex) {
-LOG.info("Failed to authenticate user '" + 
authentication.getName() + "'", ex);
-return null;
-} catch (PrivilegedActionException ex) {
-LOG.info("Failed t

git commit: CXF-5923: Create sample to demonstrate usage of search extension with Lucene and Tika. Updated index.html to support search.

2014-09-08 Thread reta
Repository: cxf
Updated Branches:
  refs/heads/master 76461079c -> 384ad7543


CXF-5923: Create sample to demonstrate usage of search extension with Lucene 
and Tika. Updated index.html to support search.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/384ad754
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/384ad754
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/384ad754

Branch: refs/heads/master
Commit: 384ad75433037358ea1607c4ddcb0cd978fae10c
Parents: 7646107
Author: reta 
Authored: Mon Sep 8 08:30:04 2014 -0400
Committer: reta 
Committed: Mon Sep 8 08:30:04 2014 -0400

--
 .../java/demo/jaxrs/search/server/Catalog.java  |  4 +-
 .../src/main/resources/browser/index.html   | 60 
 2 files changed, 62 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/384ad754/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
--
diff --git 
a/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
 
b/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
index 99d5d62..ead0cd0 100644
--- 
a/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
+++ 
b/distribution/src/main/release/samples/jax_rs/search/src/main/java/demo/jaxrs/search/server/Catalog.java
@@ -177,7 +177,7 @@ public class Catalog {
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 @Path("/search")
-public JsonArray findBook(@Context SearchContext searchContext, 
+public Response findBook(@Context SearchContext searchContext, 
 @Context final UriInfo uri) throws IOException {
 
 final IndexReader reader = DirectoryReader.open(directory);
@@ -209,7 +209,7 @@ public class Catalog {
 }
 }
 
-return builder.build();
+return 
Response.ok(builder.build()).header(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, 
"*").build();
 } finally {
 reader.close();
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/384ad754/distribution/src/main/release/samples/jax_rs/search/src/main/resources/browser/index.html
--
diff --git 
a/distribution/src/main/release/samples/jax_rs/search/src/main/resources/browser/index.html
 
b/distribution/src/main/release/samples/jax_rs/search/src/main/resources/browser/index.html
index f628345..7ab4fd4 100644
--- 
a/distribution/src/main/release/samples/jax_rs/search/src/main/resources/browser/index.html
+++ 
b/distribution/src/main/release/samples/jax_rs/search/src/main/resources/browser/index.html
@@ -20,6 +20,19 @@
 
 
 
+
+http://localhost:9000/catalog/search";>
+Query the Catalog
+   
+
+   
+   
+   
+   
+   
+   
+   
+   
  
 
 
@@ -42,6 +55,53 @@
e.preventDefault();
return false;
});
+   
+   $( "#from-search" ).submit(function(e) {
+   var query = $( "#search-query" ).val();
+   $( "#results" ).html("");
+   
+   if( query !== "" ) {
+   $.ajax({
+   url: $(this).attr("action") + "?$filter=ct=="  
+ encodeURIComponent( query ),
+   type: 'GET',
+   async: false,
+   success: function (data) {
+   var table = "\
+   \
+   \
+   \
+   \
+   \
+   \
+   \
+   \
+   ";   
+   
+   $.each(data, function (index, value) {
+   table += "\
+   \
+  \
+   
FileScoreAction
" + value.source + "" + value.