Git Product home page Git Product logo

identity-toolkit-go-client's People

Contributors

broady avatar dereksalama avatar iainmcgin avatar jonprice avatar liujin-google avatar mcduan avatar mdietz avatar naokigoogle avatar rikhul avatar tjohns avatar wuyanna avatar wyhao31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

identity-toolkit-go-client's Issues

Panic cause closing a closed chanel when ListUsers followed by UserByEmail

When I change the order (first call UserByEmail then ListUsers), everything works fine.

package main

import (
    "fmt"
    "github.com/google/identity-toolkit-go-client/gitkit"
    "golang.org/x/net/context"
)

func main() {
    fmt.Println("staring...")
    config := &gitkit.Config{
        WidgetURL:                "http://localhost/gitkit",
        CookieName:               "gtoken",
        GoogleAppCredentialsPath: "/home/orian/tmp/google-identity-toolkit/validation/project-service-account.json",
    }
    client, err := gitkit.New(context.Background(), config)
    if err != nil {
        fmt.Printf("some problem: %s", err)
        return
    }

    fmt.Println("users")
    ul := client.ListUsers(context.Background())
    if ul.Error != nil {
        fmt.Printf("Err: %s", ul.Error)
        return
    }
    for u := range ul.C {
        fmt.Println(u.Email)
    }

    fmt.Println("a specific user")
    u,err := client.UserByEmail(context.Background(), "[email protected]")
    if err != nil {
        fmt.Printf("err getting user: %s\n", err)
        return
    }else {
        fmt.Printf("got user: %s\n", u.DisplayName)
    }

    fmt.Println("...ending")
}
panic: close of closed channel

goroutine 5 [running]:
github.com/google/identity-toolkit-go-client/gitkit.(*UserList).start.func1(0xc820011680, 0x7fe077c68668, 0xc82000ad80, 0xc8200222a0)
    /gopath/src/github.com/google/identity-toolkit-go-client/gitkit/gitkit.go:243 +0x217
created by github.com/google/identity-toolkit-go-client/gitkit.(*UserList).start
    /gopath/src/github.com/google/identity-toolkit-go-client/gitkit/gitkit.go:251 +0x8c

Supporting hosted domain claims

Currently, the claims parsed from the ID Token are restricted to a specific set of hardcoded values. I'm working on a project where I would like to have support for the hd hosted domain claim as documented in Use Google Sign-In with IT Apps.

I think the simplest way to implement this would be to just add a field to the deserialization and Token struct. A more general approach could use an Extra() method similar to that on the golang.org/x/oauth2.Token type. In addition to deserializing the claims here, a map could be created and stored in a private raw field, just as oauth2 does.

I'm happy to submit a PR for either (or both) of these routes.

Usage with AppEngine

The documentation says:

 ctx := appengine.NewContext(r)
 c, err := gitkit.NewWithContext(ctx, client)

But gitkit.NewWithContext requires a context.Context
not an appengine.Context

But even with suppying a context.Context does make it work.

Add a NewWithContext function to the non appengine build

The switch to google.golang.org/appengine means that app engine projects can be be built using the standard go tools, this is useful as goapp dosn't work well with oracle, gocode etc.

The issue is there is no NewWithContext function on the non appengine build. If this was added GitKit could could be used in app engine projects and use the go tools.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.