Documentation
¶
Overview ¶
Package browserx shows a sign-in page in a browser window and reads the address the sign-in ends on. Some logins (a VPN's SAML sign-in) end by opening an address only the vendor's own program understands, such as globalprotectcallback:...; a normal browser drops it. komando starts a Chromium-family browser that is already on the computer, with an empty temporary profile, and watches it over the DevTools pipe (two file descriptors, no network port) until that address shows up.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("the sign-in window was closed before the sign-in finished")
ErrClosed: the person closed the window before the sign-in ended.
Functions ¶
Types ¶
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is a browser window komando opened for sign-ins. One Browser can show several sign-ins in a row: what the first one left (the sign-in service's own session) lets the next one pass without typing.
func Open ¶
Open starts the browser exe with a temporary profile, which shares nothing with the person's own browser. Close removes it.
func (*Browser) SignIn ¶
func (w *Browser) SignIn(ctx context.Context, page Page, prefix string, accept func(string) bool) (string, error)
SignIn shows page and returns the first address starting with prefix that the sign-in opens, redirects to or links to, and that accept takes (nil takes any). A sign-in page may name the prefix alone in a script, long before the sign-in ends; accept tells such text from the real answer. When the window is closed and only refused addresses were seen, the longest of them is returned, so the caller can say what was wrong with it. What an earlier SignIn's last page still says is not taken for this one's answer.
type Page ¶
type Page struct{ URL, HTML string }
Page is where the sign-in starts: an address, or a page to show.