Documentation
¶
Index ¶
- Constants
- func JSON2SOAP(r io.Reader, op *OpDescriptor, w io.Writer, indent bool) (err error)
- func SetupOwaRequest(translator *TranslationMiddleware, request *http.Request, json []byte, ...)
- type EwsJsonElement
- type EwsJsonType
- type EwsType
- type EwsXmlElement
- type EwsXmlJsonDefault
- type JsonHookFunc
- type JsonList
- type JsonObject
- type JsonSoapMessage
- type LoginMiddleware
- func (this *LoginMiddleware) CheckLogin(canary string) bool
- func (this *LoginMiddleware) CookieCanaryFinder(response *http.Response) (string, error)
- func (this *LoginMiddleware) OwaKeepalive()
- func (this *LoginMiddleware) RequestModifier(request *http.Request, cctx proxyutils.ChainContext) error
- func (this *LoginMiddleware) ResponseModifier(response *http.Response, cctx proxyutils.ChainContext) error
- type OpDescriptor
- type OrderedObject
- type TranslationMiddleware
- type XmlChoiceFunc
Constants ¶
simple type definitions
const NSMSG = "http://schemas.microsoft.com/exchange/services/2006/messages"
const NSSOAP = "http://schemas.xmlsoap.org/soap/envelope/"
namespaces
const NSTYPE = "http://schemas.microsoft.com/exchange/services/2006/types"
Variables ¶
This section is empty.
Functions ¶
func JSON2SOAP ¶
JSON2SOAP converts a json message to a SOAP message .. always server -> client .. and we always know what type we're expecting
func SetupOwaRequest ¶
Types ¶
type EwsJsonElement ¶
type EwsJsonElement struct {
JsonName string
// key is the json type
Types map[string]*EwsJsonType
// key is the xml local element name (only used in hooks)
Elements map[string]*EwsJsonType
SingleType *EwsJsonType
IsList bool
// used to determine which type should be used
XmlChoiceHook XmlChoiceFunc
}
EwsJsonElement is used for JSON -> XML conversion
func NewEwsJsonElement ¶
func NewEwsJsonElement(xmlName string, jsonName string, isList bool) *EwsJsonElement
func (*EwsJsonElement) IsCharData ¶
func (e *EwsJsonElement) IsCharData() bool
type EwsJsonType ¶
func NewEwsJsonType ¶
func NewEwsJsonType(xmlLocal string, typ *EwsType) *EwsJsonType
type EwsType ¶
type EwsType struct {
Name string
Attributes []element
// lookup for XML -> JSON
TypeByElementName map[string]*EwsXmlElement
JsonDefaults []EwsXmlJsonDefault
// lookup for JSON -> XML
// -> list is for ordering, map is for when type lookup is required
JsonElementList []*EwsJsonElement
JsonExtra []string
// XML attributes, key is XmlName
Attrs map[string]*EwsType
// key is XmlName, value is JsonName
AttrsNames map[string]string
AnyAttr bool
IsSimple bool
SimpleType int
TextAttr string
JsonType string
IsList bool
JsonListName string
JsonListElement *EwsJsonElement // only set if JsonListName/IsList is
JsonHook JsonHookFunc // only set if special function is needed
EnumValues []string // if this is an eumeration, these are the values
ListItemTypeStr string // the type of the listObj
ListItemType *EwsType // ListItemTypeStr converted to a type
// contains filtered or unexported fields
}
func (*EwsType) Initialize ¶
func (v *EwsType) Initialize()
type EwsXmlElement ¶
EwsXmlElement is used for XML -> JSON conversion
type EwsXmlJsonDefault ¶
type EwsXmlJsonDefault struct {
JsonName string
JsonDefault interface{}
}
type JsonHookFunc ¶
type JsonHookFunc func(*EwsType, *OrderedObject)
type JsonObject ¶
type JsonObject map[string]interface{}
only use these for deserialization, need ordered type for serialization
type JsonSoapMessage ¶
type LoginMiddleware ¶
type LoginMiddleware struct {
Translator *TranslationMiddleware
Redirector *proxyutils.RedirectorMiddleware
// string contains on path; typically /owa/
CheckPath string
// used for ews client
Transport http.RoundTripper
// disabled if 0
KeepAlivePeriod time.Duration
CanaryFinder func(*http.Response) (string, error)
// contains filtered or unexported fields
}
this middleware needs to be first in the chain
func (*LoginMiddleware) CheckLogin ¶
func (this *LoginMiddleware) CheckLogin(canary string) bool
CheckLogin returns false if login is required, and will invalidate the canary if the server responds that it is invalid
func (*LoginMiddleware) CookieCanaryFinder ¶
func (this *LoginMiddleware) CookieCanaryFinder(response *http.Response) (string, error)
func (*LoginMiddleware) OwaKeepalive ¶
func (this *LoginMiddleware) OwaKeepalive()
func (*LoginMiddleware) RequestModifier ¶
func (this *LoginMiddleware) RequestModifier(request *http.Request, cctx proxyutils.ChainContext) error
func (*LoginMiddleware) ResponseModifier ¶
func (this *LoginMiddleware) ResponseModifier(response *http.Response, cctx proxyutils.ChainContext) error
This processes /owa/ pages and searches for a valid OWA canary in the page cookies. Once the canary has been found, then it redirects to the /close page
type OpDescriptor ¶
type OpDescriptor struct {
Action string
Request *EwsType
Response EwsJsonElement
BodyType string
RequestType string
}
type OrderedObject ¶
type OrderedObject struct {
Object json.OrderedObject
// contains filtered or unexported fields
}
OrderedObject is only used for adding items, because json.OrderedObject is actually a slice
func NewOrderedObject ¶
func NewOrderedObject() *OrderedObject
func (*OrderedObject) Get ¶
func (obj *OrderedObject) Get(key string) (value interface{}, exists bool)
func (*OrderedObject) Set ¶
func (obj *OrderedObject) Set(key string, value interface{}) (exists bool)
Set returns true if item added, false if it already exists
type TranslationMiddleware ¶
type TranslationMiddleware struct {
// Set to true if you want to see additional logging
Debug bool
// default is "/ews/exchange.asmx"
EwsPath string
// default is "/owa/service.svc"
OwaServicePath string
// OWA Canary value, required for the OWA service to work
OwaCanary string
// function pointers controlling various aspects of the transport
OnEwsLogin func() // called whenever a login occurs. probably.
OnEwsSuccess func() // called whenever a successful EWS transaction occurs
OnEwsTimeout func() // called whenever an EWS timeout is detected
OnEwsTranslationError func(transactionLog *bytes.Buffer)
// contains filtered or unexported fields
}
TranslationMiddleware implements a reverse proxy that allows EWS clients to talk to an OWA endpoint
func NewTranslationMiddleware ¶
func NewTranslationMiddleware() *TranslationMiddleware
Creates an TranslationMiddleware object with lots of defaults filled in
func (*TranslationMiddleware) RequestModifier ¶
func (this *TranslationMiddleware) RequestModifier(request *http.Request, cctx proxyutils.ChainContext) error
func (*TranslationMiddleware) ResponseModifier ¶
func (this *TranslationMiddleware) ResponseModifier(response *http.Response, cctx proxyutils.ChainContext) error
type XmlChoiceFunc ¶
type XmlChoiceFunc func(*EwsJsonElement, map[string]interface{}) (*EwsJsonType, error)