<commit_before>/*
 */

package com.googlecode.batchfb;

import java.util.Arrays;

import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.codec.binary.Base64;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;


/**
 * <p>This will decypher and validate the OAuth 2.0 cookie you get from Facebook.  You can recognize it because
 * it starts with "fbsr_".  This code does *not* work with the older "fbs_" OAuth 1.0 cookie.</p>
 * 
 * <p>This is the ONLY class in batchfb that relies on commons-codec.  This is just for the Base64 decoder,
 * which intelligently handles "urlsafe" base64 strings with _ and - instead of + and *.  The base64 decoder
 * in JAXB doesn't, so we need the 3rd party lib.</p>
 */
public class FacebookCookie
{
	/** */
	private static final ObjectMapper MAPPER = new ObjectMapper();
	static {
		MAPPER.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	}

	/** */
	@JsonProperty("algorithm")
	String algorithm;

	/** */
	@JsonProperty("user_id")
	long fbId;
	public long getFbId() { return this.fbId; }

	/** Despite being present in Python running samples app, this doesn't seem to actually show up. Expect it to be null. */
	@JsonProperty("oauth_token")
	String accessToken;
	public String getAccessToken() { return this.accessToken; }

	/** This shows up instead of oauth_token, but isn't documented */
	@JsonProperty("code")
	String code;
	public String getCode() { return this.code; }

	/**
	 * Decodes and validates the cookie.
	 * @param cookie is the fbsr_YOURAPPID cookie from Facebook
	 * @param appSecret is your application secret from the Facebook Developer application console
	 * @throws IllegalStateException if the cookie does not validate 
	 */<commit_msg>Even better javadocs<commit_after>/*
 */

package com.googlecode.batchfb;

import java.util.Arrays;

import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.codec.binary.Base64;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.DeserializationConfig.Feature;
import org.codehaus.jackson.map.ObjectMapper;


/**
 * <p>This will decypher and validate the OAuth 2.0 cookie you get from Facebook.  You can recognize it because
 * it starts with "fbsr_".  This code does *not* work with the older "fbs_" OAuth 1.0 cookie.</p>
 * 
 * <p>This is the ONLY class in batchfb that relies on commons-codec.  This is just for the Base64 decoder,
 * which intelligently handles "urlsafe" base64 strings with _ and - instead of + and *.  The base64 decoder
 * in JAXB doesn't, so we need the 3rd party lib.</p>
 */
public class FacebookCookie
{
	/** */
	private static final ObjectMapper MAPPER = new ObjectMapper();
	static {
		MAPPER.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	}

	/** */
	@JsonProperty("algorithm")
	String algorithm;

	/** */
	@JsonProperty("user_id")
	long fbId;
	public long getFbId() { return this.fbId; }

	@JsonProperty("oauth_token")
	String accessToken;
	/** Despite being present in Python running samples app, this doesn't seem to actually show up. Expect it to be null. */
	public String getAccessToken() { return this.accessToken; }

	@JsonProperty("code")
	String code;
	/** This shows up in the cookie payload instead of oauth_token, but isn't documented */
	public String getCode() { return this.code; }

	/**
	 * Decodes and validates the cookie.
	 * @param cookie is the fbsr_YOURAPPID cookie from Facebook
	 * @param appSecret is your application secret from the Facebook Developer application console
	 * @throws IllegalStateException if the cookie does not validate 
	 */
{'fraction_non_alphanumeric': 0.09933949801849405, 'fraction_numerical': 0.006869220607661823, 'mean_word_length': 4.251040221914009, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5822827', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1112, 'n_words': 400}