1- package cas_test
1+ package cas
22
33import (
44 "fmt"
55 "log"
66 "net/http"
77 "net/url"
8-
9- "gopkg.in/cas.v1"
108)
119
1210func ExampleRedirectToLogin () {
1311 u , _ := url .Parse ("https://cas.example.com" )
14- c := cas . NewClient (& cas. Options {
12+ c := NewClient (& Options {
1513 URL : u ,
1614 })
1715
1816 h := c .HandleFunc (func (w http.ResponseWriter , r * http.Request ) {
19- cas . RedirectToLogin (w , r )
17+ RedirectToLogin (w , r )
2018 })
2119
2220 err := http .ListenAndServe (":8080" , h )
@@ -27,12 +25,12 @@ func ExampleRedirectToLogin() {
2725
2826func ExampleRedirectToLogout () {
2927 u , _ := url .Parse ("https://cas.example.com" )
30- c := cas . NewClient (& cas. Options {
28+ c := NewClient (& Options {
3129 URL : u ,
3230 })
3331
3432 h := c .HandleFunc (func (w http.ResponseWriter , r * http.Request ) {
35- cas . RedirectToLogout (w , r )
33+ RedirectToLogout (w , r )
3634 })
3735
3836 err := http .ListenAndServe (":8080" , h )
@@ -43,13 +41,13 @@ func ExampleRedirectToLogout() {
4341
4442func ExampleIsAuthenticated () {
4543 u , _ := url .Parse ("https://cas.example.com" )
46- c := cas . NewClient (& cas. Options {
44+ c := NewClient (& Options {
4745 URL : u ,
4846 })
4947
5048 h := c .HandleFunc (func (w http.ResponseWriter , r * http.Request ) {
51- if ! cas . IsAuthenticated (r ) {
52- cas . RedirectToLogout (w , r )
49+ if ! IsAuthenticated (r ) {
50+ RedirectToLogout (w , r )
5351 }
5452
5553 fmt .Fprintf (w , "Hello World\n " )
@@ -63,16 +61,16 @@ func ExampleIsAuthenticated() {
6361
6462func ExampleUsername () {
6563 u , _ := url .Parse ("https://cas.example.com" )
66- c := cas . NewClient (& cas. Options {
64+ c := NewClient (& Options {
6765 URL : u ,
6866 })
6967
7068 h := c .HandleFunc (func (w http.ResponseWriter , r * http.Request ) {
71- if ! cas . IsAuthenticated (r ) {
72- cas . RedirectToLogout (w , r )
69+ if ! IsAuthenticated (r ) {
70+ RedirectToLogout (w , r )
7371 }
7472
75- fmt .Fprintf (w , "Hello %s\n " , cas . Username (r ))
73+ fmt .Fprintf (w , "Hello %s\n " , Username (r ))
7674 })
7775
7876 err := http .ListenAndServe (":8080" , h )
0 commit comments