@@ -14,9 +14,10 @@ import (
14
14
15
15
// Client configuration options
16
16
type Options struct {
17
- URL * url.URL // URL to the CAS service
18
- Store TicketStore // Custom TicketStore, if nil a MemoryStore will be used
19
- Client * http.Client // Custom http client to allow options for http connections
17
+ URL * url.URL // URL to the CAS service
18
+ Store TicketStore // Custom TicketStore, if nil a MemoryStore will be used
19
+ Client * http.Client // Custom http client to allow options for http connections
20
+ SendService bool // Custom sendService to determine whether you need to send service param
20
21
}
21
22
22
23
// Client implements the main protocol
@@ -25,8 +26,9 @@ type Client struct {
25
26
tickets TicketStore
26
27
client * http.Client
27
28
28
- mu sync.Mutex
29
- sessions map [string ]string
29
+ mu sync.Mutex
30
+ sessions map [string ]string
31
+ sendService bool
30
32
}
31
33
32
34
// NewClient creates a Client with the provided Options.
@@ -50,10 +52,11 @@ func NewClient(options *Options) *Client {
50
52
}
51
53
52
54
return & Client {
53
- url : options .URL ,
54
- tickets : tickets ,
55
- client : client ,
56
- sessions : make (map [string ]string ),
55
+ url : options .URL ,
56
+ tickets : tickets ,
57
+ client : client ,
58
+ sessions : make (map [string ]string ),
59
+ sendService : options .SendService ,
57
60
}
58
61
}
59
62
@@ -115,6 +118,17 @@ func (c *Client) LogoutUrlForRequest(r *http.Request) (string, error) {
115
118
return "" , err
116
119
}
117
120
121
+ if c .sendService {
122
+ service , err := requestURL (r )
123
+ if err != nil {
124
+ return "" , err
125
+ }
126
+
127
+ q := u .Query ()
128
+ q .Add ("service" , sanitisedURLString (service ))
129
+ u .RawQuery = q .Encode ()
130
+ }
131
+
118
132
return u .String (), nil
119
133
}
120
134
0 commit comments