client/views.aug
OpenID Connect login application · Source and specification
Files in this project
main.augclient/contracts.augclient/endpoints.augclient/export.augclient/login.augclient/logout.augclient/protocol.augclient/session.augclient/views.augcommon/export.augcommon/headers.augcommon/keys.augcommon/settings.augcommon/views.augprovider/authorization.augprovider/contracts.augprovider/credentials.augprovider/discovery.augprovider/export.augprovider/token.augprovider/userinfo.augprovider/views.aug
Code
// aug-spec: "views.aug.md" explains this file. Read it before changes; refresh with aug spec.
import SessionClaims from contracts
import Page from common
import logout from logout
LoginPage():
return <Page title={"Sign in"}><p>This August app is both an OpenID Connect provider and a login client.</p><p><a href={"/login/start"} style={"display:inline-block;padding:12px 20px;border-radius:10px;background:#4852d7;color:white;text-decoration:none"}>Sign in with OpenID Connect</a></p><p>The server uses authorization codes, S256 PKCE, state and nonce validation. Your session is a separate signed JWT in an HttpOnly cookie.</p></Page>
Welcome(SessionClaims session):
return <Page title={"Welcome, " + session.name}><p>You are signed in as <strong>{session.name}</strong>.</p><p>Subject: <code>{session.sub}</code></p><p><a href={"/me"}>View the protected JSON endpoint</a></p><form method={"post"} action={"/logout"} onSubmit={handle logout(input from form)}><input type={"hidden"} name={"csrf"} value={session.csrf} /><button type={"submit"} style={"padding:10px 18px;border-radius:10px;border:0;background:#17233a;color:white;font:inherit"}>Sign out</button></form></Page>// aug-spec: "views.aug.md" explains this file. Read it before changes; refresh with aug spec.
import SessionClaims from contracts
import Page from common
import logout from logout
LoginPage() {
return <Page title={"Sign in"}><p>This August app is both an OpenID Connect provider and a login client.</p><p><a href={"/login/start"} style={"display:inline-block;padding:12px 20px;border-radius:10px;background:#4852d7;color:white;text-decoration:none"}>Sign in with OpenID Connect</a></p><p>The server uses authorization codes, S256 PKCE, state and nonce validation. Your session is a separate signed JWT in an HttpOnly cookie.</p></Page>
}
Welcome(SessionClaims session) {
return <Page title={"Welcome, " + session.name}><p>You are signed in as <strong>{session.name}</strong>.</p><p>Subject: <code>{session.sub}</code></p><p><a href={"/me"}>View the protected JSON endpoint</a></p><form method={"post"} action={"/logout"} onSubmit={handle logout(input from form)}><input type={"hidden"} name={"csrf"} value={session.csrf} /><button type={"submit"} style={"padding:10px 18px;border-radius:10px;border:0;background:#17233a;color:white;font:inherit"}>Sign out</button></form></Page>
}Compiled specification
LoginPage · source
It returns the server component Page with title = "Sign in" containing a paragraph containing This August app is both an OpenID Connect provider and a login client. with escaped text, a paragraph containing a link with href = "/login/start", style = "display:inline-block;padding:12px 20px;border-radius:10px;background:#4852d7;color:white;text-decoration:none" containing Sign in with OpenID Connect with escaped text with escaped text, a paragraph containing The server uses authorization codes, S256 PKCE, state and nonce validation. Your session is a separate signed JWT in an HttpOnly cookie. with escaped text with escaped text. source
Checked interface
LoginPage() returns HtmlWelcome · source
It takes session as SessionClaims. Failures can raise HttpError.
It returns the server component Page with title = the text Welcome, {session.name} containing a paragraph containing You are signed in as , the HTML element strong containing session.name with escaped text, . with escaped text, a paragraph containing Subject: , the HTML element code containing session.sub with escaped text with escaped text, a paragraph containing a link with href = "/me" containing View the protected JSON endpoint with escaped text with escaped text, the HTML element form with method = "post", action = "/logout", onSubmit = a form action that sends POST /logout to logout on submission containing the HTML element input with type = "hidden", name = "csrf", value = session.csrf with escaped text, a button with type = "submit", style = "padding:10px 18px;border-radius:10px;border:0;background:#17233a;color:white;font:inherit" containing Sign out with escaped text with escaped text with escaped text. source
Checked interface
Welcome(SessionClaims session) returns Html unless HttpErrorIt takes session as SessionClaims. Failures can raise HttpError.
Dependencies
It uses SessionClaims (csrf, name, and sub) from contracts. It uses logout from logout. It uses Page from common.