identity-toolkit-go-client

Apache
Google Go
未知
Google
2015-04-24
大胖森

identity-toolkit-go-client 是 Go 语言环境中的 Google identity Toolkit 客户端库。

示例:

var client *gitkit.Client

func handleSignIn(w http.ResponseWriter, r *http.Request) {
    // If there is no valid session, check identity tookit ID token.
    ts := client.TokenFromRequest(r)
    token, err := client.ValidateToken(ts)
    if err != nil {
        // Not a valid token. Handle error.
    }
    // Token is validate and it contains the user account information
    // including user ID, email address, etc.
    // Issue your own session cookie to finish the sign in.
}

func main() {
    // Provide configuration. gitkit.LoadConfig() can also be used to load
    // the configuration from a JSON file.
    config := &gitkit.Config{
        ClientID: "123.apps.googleusercontent.com",
        WidgetURL: "http://localhost/gitkit",
        ServerAPIKey: "server_api_key",
        ServiceAccount: "123-abc@developer.gserviceaccount.com",
        PEMKeyPath: "/path/to/service_account/private-key.pem",
    }
    var err error
    client, err = gitkit.New(config)
    if err != nil {
        // Handle error.
    }

    // Provide HTTP handler.
    http.HandleFunc("/signIn", handleSignIn)
    // Start the server.
    log.Fatal(http.ListenAndServe(":8080", nil))
}


加载中

评论(0)

暂无评论

暂无资讯

暂无问答

Defining service endpoints

Defining service endpoints Each of the services in our cloud environment runs on a particular URL and port—these are the endpoint addresses for our services. When a client comm...

2013/08/14 16:21
40
0
More On REST

Jon Flanders Contents Which is better, REST or SOAP? What about security? Isn't SOAP more secure than REST? What about transactions? What about interoperability? Isn't SOAP supp...

2011/04/28 23:47
84
0
.NET库、工具、框架和软件的集合

善于总结,养成良好学习习惯!.NET库、工具、框架和软件的集合

2015/11/21 13:01
292
0
Kerberos - Authentication

The Internet is an insecure place. Many of the protocols used in the Internet do not provide any security. Tools to "sniff" passwords off of the network are in common use by mal...

2012/08/10 14:44
91
0
JDK下载历史版本

http://www.oracle.com/technetwork/java/javase/archive-139210.html Java SE Java SE 8 Java SE 7 Java SE 6 Java SE 5 Java SE 1.4 Java SE 1.3 Java SE 1.2 Java SE 1.1 JRockit Family ...

2016/09/27 23:36
28
0
PHP开发移动端接口(增强版)

前面讲过:移动端与PHP服务端接口通信流程设计(基础版) 对于 api_token 的校验,其安全性还可再增强: 增强地方一: 再增加2张表,一个接口表,一个授权表,设计参考如下: 接口表 字段名 字...

2015/08/18 09:55
207
0
Oauth2认证授权服务(django-oauth-toolkit)搭建及操作流程

介绍oauth2的认证流程及授权实验操作方法,具体oauth的授权方式有几种,下面主要是描述授权码的方式

2016/10/21 10:33
1K
0
.NET Open Source Developer Projects

This community maintained list showcases .NET open source developer projects. It is intended to include projects that are useful for any aspect of the development process. For c...

2015/08/26 18:51
103
0

没有更多内容

加载失败,请刷新页面

返回顶部
顶部