func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) {
	type tokenType struct {
		Type string `json:"type"`
	}
	return json.Marshal(tokenType{
		Type: "ServicePrincipalNoSecret",
	})
}
MarshalJSON implements the json.Marshaler interface.
package adal
import (
	"context"
	"crypto/rand"
	"crypto/rsa"
	"crypto/sha1"
	"crypto/x509"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"math"
	"net"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/Azure/go-autorest/autorest/date"
	"github.com/Azure/go-autorest/version"
	"github.com/dgrijalva/jwt-go"
)
const (
	defaultRefresh = 5 * time.Minute
	OAuthGrantTypeDeviceCode = "device_code"
	OAuthGrantTypeClientCredentials = "client_credentials"
	OAuthGrantTypeUserPass = "password"
	OAuthGrantTypeRefreshToken = "refresh_token"
	OAuthGrantTypeAuthorizationCode = "authorization_code"
	metadataHeader = "Metadata"
	msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token"
	defaultMaxMSIRefreshAttempts = 5
)
type OAuthTokenProvider interface {
	OAuthToken() string
}
type TokenRefreshError interface {
	error
	Response() *http.Response
}
type Refresher interface {
	Refresh() error
	RefreshExchange(resource string) error
	EnsureFresh() error
}
type RefresherWithContext interface {
	RefreshWithContext(ctx context.Context) error
	RefreshExchangeWithContext(ctx context.Context, resource string) error
	EnsureFreshWithContext(ctx context.Context) error
}
type TokenRefreshCallback func(Token) error
type Token struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn string `json:"expires_in"`
	ExpiresOn string `json:"expires_on"`
	NotBefore string `json:"not_before"`
	Resource string `json:"resource"`
	Type     string `json:"token_type"`
}
func (t Token) IsZero() bool {
	return t == Token{}
}
func (t Token) Expires() time.Time {
	s, err := strconv.Atoi(t.ExpiresOn)
	if err != nil {
		s = -3600
	}
	expiration := date.NewUnixTimeFromSeconds(float64(s))
	return time.Time(expiration).UTC()
}
func (t Token) IsExpired() bool {
	return t.WillExpireIn(0)
}
func (t Token) WillExpireIn(d time.Duration) bool {
	return !t.Expires().After(time.Now().Add(d))
}
func (t *Token) OAuthToken() string {
	return t.AccessToken
}
type ServicePrincipalSecret interface {
	SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error
}
type ServicePrincipalNoSecret struct {
}
func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
	return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token")
}