mirror of
https://github.com/astaxie/beego.git
synced 2025-06-11 07:20:39 +00:00
update the documents & comments
This commit is contained in:
@ -27,11 +27,11 @@
|
||||
//
|
||||
//
|
||||
// Advanced Usage:
|
||||
// func SecretAuth(username, password string) bool {
|
||||
// return username == "astaxie" && password == "helloBeego"
|
||||
// }
|
||||
// authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
|
||||
// beego.InsertFilter("*", beego.BeforeRouter,authPlugin)
|
||||
// func SecretAuth(username, password string) bool {
|
||||
// return username == "astaxie" && password == "helloBeego"
|
||||
// }
|
||||
// authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
|
||||
// beego.InsertFilter("*", beego.BeforeRouter,authPlugin)
|
||||
package auth
|
||||
|
||||
import (
|
||||
|
@ -14,26 +14,25 @@
|
||||
|
||||
// Package cors provides handlers to enable CORS support.
|
||||
// Usage
|
||||
//
|
||||
// import (
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/cors"
|
||||
// import (
|
||||
// "github.com/astaxie/beego"
|
||||
// "github.com/astaxie/beego/plugins/cors"
|
||||
// )
|
||||
|
||||
//func main() {
|
||||
// // CORS for https://foo.* origins, allowing:
|
||||
// // - PUT and PATCH methods
|
||||
// // - Origin header
|
||||
// // - Credentials share
|
||||
// beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
|
||||
// AllowOrigins: []string{"https://*.foo.com"},
|
||||
// AllowMethods: []string{"PUT", "PATCH"},
|
||||
// AllowHeaders: []string{"Origin"},
|
||||
// ExposeHeaders: []string{"Content-Length"},
|
||||
// AllowCredentials: true,
|
||||
// }))
|
||||
// beego.Run()
|
||||
//}
|
||||
//
|
||||
// func main() {
|
||||
// // CORS for https://foo.* origins, allowing:
|
||||
// // - PUT and PATCH methods
|
||||
// // - Origin header
|
||||
// // - Credentials share
|
||||
// beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
|
||||
// AllowOrigins: []string{"https://*.foo.com"},
|
||||
// AllowMethods: []string{"PUT", "PATCH"},
|
||||
// AllowHeaders: []string{"Origin"},
|
||||
// ExposeHeaders: []string{"Content-Length"},
|
||||
// AllowCredentials: true,
|
||||
// }))
|
||||
// beego.Run()
|
||||
// }
|
||||
package cors
|
||||
|
||||
import (
|
||||
|
@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package cors provides handlers to enable CORS support.
|
||||
package cors
|
||||
|
||||
import (
|
||||
|
Reference in New Issue
Block a user