Upgrade to Serde 1.0 (#2)

* Bump openssl
* Fix naive code that was breaking serde 1.0
This commit is contained in:
Thomas Gideon 2017-05-01 13:38:04 -04:00 committed by GitHub
parent 0aa3aa6faa
commit f1db24606b
4 changed files with 22 additions and 22 deletions

View file

@ -1,6 +1,7 @@
use base64::{decode_config, encode_config, URL_SAFE_NO_PAD};
use error::Error;
use serde::{Deserialize, Serialize};
use serde::Serialize;
use serde::de::DeserializeOwned;
use serde_json;
use serde_json::value::Value;
use super::Result;
@ -9,7 +10,7 @@ use time::{self, Timespec};
/// A default claim set, including the standard, or registered, claims and the ability to specify
/// your own as custom claims.
#[derive(Debug, Serialize, Deserialize, Default, PartialEq)]
pub struct Payload<T: Serialize + Deserialize + PartialEq> {
pub struct Payload<T> {
#[serde(skip_serializing_if = "Option::is_none")]
pub iss: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@ -32,7 +33,7 @@ pub struct Payload<T: Serialize + Deserialize + PartialEq> {
/// satisfies Claims' generic parameter as simply and clearly as possible.
pub type DefaultPayload = Payload<()>;
impl<T: Serialize + Deserialize + PartialEq> Payload<T> {
impl<T: Serialize + DeserializeOwned> Payload<T> {
/// This implementation simply parses the base64 data twice, first parsing out the standard
/// claims then any custom claims, assigning the latter into a copy of the former before
/// returning registered and custom claims.