<commit_before># XHub4J [![Build Status](https://travis-ci.org/McFoggy/xhub4j.svg?branch=master)](https://travis-ci.org/McFoggy/xhub4j)

XHub4J is a set of utilities to allow to secured webhooks either as a sender or as a consumer.

## xhub4j-core

Can be used standalone to create `X-Hub-Signature` HTTP headers.

For example to create a `X-Hub-Signature` exactly like github does:

```
String token = "key";
String data = "The quick brown fox jumps over the lazy dog";
String expectedResult = "sha1=de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";

String generatedHeader = XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, token, data.getBytes());
assertThat(generatedHeader, is(expectedResult));
```

## xhub4j-servlet

Provides a servlet Filter to secure a webhook consumer.<commit_msg>add maven coordinates<commit_after># XHub4J [![Build Status](https://travis-ci.org/McFoggy/xhub4j.svg?branch=master)](https://travis-ci.org/McFoggy/xhub4j)

XHub4J is a set of utilities to allow to secured webhooks either as a sender or as a consumer.

## maven coordinates

```
<dependency>
    <groupId>fr.brouillard.oss.security.xhub</groupId>
    <artifactId>xhub4j-core</artifactId>
    <version>X.Y.Z</version>
</dependency>
<dependency>
    <groupId>fr.brouillard.oss.security.xhub</groupId>
    <artifactId>xhub4j-servlet</artifactId>
    <version>X.Y.Z</version>
</dependency>
<dependency>
    <groupId>fr.brouillard.oss.security.xhub</groupId>
    <artifactId>xhub4j-jaxrs-client</artifactId>
    <version>X.Y.Z</version>
</dependency>
```

## xhub4j-core

Can be used standalone to create `X-Hub-Signature` HTTP headers.

For example to create a `X-Hub-Signature` exactly like github does:

```
String token = "key";
String data = "The quick brown fox jumps over the lazy dog";
String expectedResult = "sha1=de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";

String generatedHeader = XHub.generateHeaderXHubToken(XHubConverter.HEXA_LOWERCASE, XHubDigest.SHA1, token, data.getBytes());
assertThat(generatedHeader, is(expectedResult));
```

## xhub4j-servlet

Provides a servlet Filter to secure a webhook consumer.
{'fraction_non_alphanumeric': 0.1231203007518797, 'fraction_numerical': 0.029605263157894735, 'mean_word_length': 5.393393393393393, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4341882', 'n_tokens_mistral': 797, 'n_tokens_neox': 741, 'n_words': 174}