auth/internal/domain/ticket.go

29 lines
616 B
Go
Raw Normal View History

2021-12-29 20:07:23 +00:00
package domain
import (
"net/url"
2021-12-29 20:07:23 +00:00
"testing"
)
type Ticket struct {
// The access token will work at this URL.
Resource *url.URL
2021-12-29 20:07:23 +00:00
// The access token should be used when acting on behalf of this URL.
2023-08-07 03:05:22 +00:00
Subject Me
// A random string that can be redeemed for an access token.
Ticket string
2021-12-29 20:07:23 +00:00
}
2022-01-29 17:50:45 +00:00
// TestTicket returns valid random generated ticket for tests.
2021-12-29 20:07:23 +00:00
func TestTicket(tb testing.TB) *Ticket {
tb.Helper()
return &Ticket{
Resource: &url.URL{Scheme: "https", Host: "alice.example.com", Path: "/private/"},
2023-08-07 03:05:22 +00:00
Subject: *TestMe(tb, "https://bob.example.com/"),
2021-12-29 20:07:23 +00:00
Ticket: "32985723984723985792834",
}
}