Anonymous
No-auth mode
It's not an auth strategy but a mode without any authentication flow applied to the SPClient.
Anonymous mode can be handy in a situation when Gosip SharePoint-aware helpers intended to be used however authentication is handled by any other middleware.

Struct

Only SiteURL is required.
1
type AuthCnfg struct {
2
// SPSite or SPWeb URL, which is the context target for the API calls
3
SiteURL string `json:"siteUrl"`
4
}
Copied!

JSON

private.json sample:
1
{
2
"siteUrl": "https://www.contoso.com/sites/test"
3
}
Copied!

Code sample

1
package main
2
3
import (
4
"log"
5
// "os"
6
7
"github.com/koltyakov/gosip"
8
strategy "github.com/koltyakov/gosip/auth/anon"
9
)
10
11
func main() {
12
13
// authCnfg := &strategy.AuthCnfg{
14
// SiteURL: os.Getenv("SPAUTH_SITEURL"),
15
// }
16
// or using `private.json` creds source
17
18
authCnfg := &strategy.AuthCnfg{}
19
configPath := "./config/private.json"
20
if err := authCnfg.ReadConfig(configPath); err != nil {
21
log.Fatalf("unable to get config: %v", err)
22
}
23
24
client := &gosip.SPClient{AuthCnfg: authCnfg}
25
// use client in raw requests or bind it with Fluent API ...
26
27
}
Copied!
Export as PDF
Copy link