func (p *Policy) ParseToken(str string) (*TokenClaims, bool, error) {
	// parse token and check id
	var claims TokenClaims
	_, err := jwt.ParseWithClaims(str, &claims, func(_ *jwt.Token) (interface{}, error) {
		return p.Secret, nil
	})
	if valErr, ok := err.(*jwt.ValidationError); ok && valErr.Errors == jwt.ValidationErrorExpired {
		return nil, true, err
	} else if err != nil {
		return nil, false, err
	} else if !bson.IsObjectIdHex(claims.Id) {
		return nil, false, errors.New("invalid id")
	}

	return &claims, false, nil
}
func (p *Policy) ParseToken(str string) (*TokenClaims, bool, error) {
	
	var claims TokenClaims
	_, err := jwt.ParseWithClaims(str, &claims, func(_ *jwt.Token) (interface{}, error) {
		return p.Secret, nil
	})
	if valErr, ok := err.(*jwt.ValidationError); ok && valErr.Errors == jwt.ValidationErrorExpired {
		return nil, true, err
	} else if err != nil {
		return nil, false, err
	} else if !bson.IsObjectIdHex(claims.Id) {
		return nil, false, errors.New("invalid id")
	}

	return &claims, false, nil
}
func ( p * Policy ) ParseToken ( str string ) ( * TokenClaims , bool , error ) { // parse token and check id var claims TokenClaims _ , err := jwt . ParseWithClaims ( str , & claims , func ( _ * jwt . Token ) ( interface { } , error ) { return p . Secret , nil } ) if valErr , ok := err . ( * jwt . ValidationError ) ; ok && valErr . Errors == jwt . ValidationErrorExpired { return nil , true , err } else if err != nil { return nil , false , err } else if ! bson . IsObjectIdHex ( claims . Id ) { return nil , false , errors . New ( " " ) } return & claims , false , nil }
// ParseToken will parse the presented token and return its claims, if it is
// expired and eventual errors.
ParseToken will parse the presented token and return its claims if it is expired and eventual errors .