本文整理汇总了Golang中github.com/xtraclabs/roll/roll.Core.Secure方法的典型用法代码示例。如果您正苦于以下问题:Golang Core.Secure方法的具体用法?Golang Core.Secure怎么用?Golang Core.Secure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/xtraclabs/roll/roll.Core
的用法示例。
在下文中一共展示了Core.Secure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Handler
//Handler creates a much with handlers for all routes in the roll application
func Handler(core *roll.Core) http.Handler {
mux := http.NewServeMux()
//Wrap roll services with the auth checker if booted in secure mode
if core.Secure() {
rollClientID := os.Getenv("ROLL_CLIENTID")
if rollClientID == "" {
panic(errors.New("Cannot run in secure mode without a client ID to white list (from ROLL_CLIENTID env variable)"))
}
whitelist := []string{rollClientID}
mux.Handle(DevelopersBaseURI, authzwrapper.Wrap(core.SecretsRepo, core.AdminRepo, whitelist, handleDevelopersBase(core)))
mux.Handle(DevelopersURI, authzwrapper.Wrap(core.SecretsRepo, core.AdminRepo, whitelist, handleDevelopers(core)))
mux.Handle(ApplicationsURI, authzwrapper.Wrap(core.SecretsRepo, core.AdminRepo, whitelist, handleApplications(core)))
mux.Handle(ApplicationsBaseURI, authzwrapper.Wrap(core.SecretsRepo, core.AdminRepo, whitelist, handleApplicationsBase(core)))
mux.Handle(JWTFlowCertsURI, authzwrapper.Wrap(core.SecretsRepo, core.AdminRepo, whitelist, handleJWTFlowCerts(core)))
} else {
mux.Handle(DevelopersBaseURI, authzwrapper.WrapUnsecure(handleDevelopersBase(core)))
mux.Handle(DevelopersURI, authzwrapper.WrapUnsecure(handleDevelopers(core)))
mux.Handle(ApplicationsURI, authzwrapper.WrapUnsecure(handleApplications(core)))
mux.Handle(ApplicationsBaseURI, authzwrapper.WrapUnsecure(handleApplicationsBase(core)))
mux.Handle(JWTFlowCertsURI, authzwrapper.WrapUnsecure(handleJWTFlowCerts(core)))
}
mux.Handle(AuthorizeBaseURI, handleAuthorize(core))
mux.Handle(ValidateBaseURI, handleValidate(core))
mux.Handle(OAuth2TokenBaseURI, handleToken(core))
mux.Handle(TokenInfoURI, handleTokenInfo(core))
return mux
}