From 76060dd85061a43efe68db8c5d0dac37e1dccc1c Mon Sep 17 00:00:00 2001 From: Daniel DeGroff Date: Tue, 2 Jul 2024 12:10:21 -0600 Subject: [PATCH 01/22] cleanup, naming. --- build.savant | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build.savant b/build.savant index f62c3fd..78b726d 100644 --- a/build.savant +++ b/build.savant @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023, FusionAuth, All Rights Reserved + * Copyright (c) 2019-2024, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,17 @@ project(group: "io.fusionauth", name: "go-client", version: "1.51.1", licenses: release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.6") target(name: "clean", description: "Cleans build directory") { + ProcessBuilder pb = new ProcessBuilder("go", "clean", "-x") + .inheritIO() + .directory(new File("./pkg/fusionauth/")) + + def process = pb.start() + process.consumeProcessOutput(System.out, System.err) + process.waitFor() } target(name: "format", description: "Formats the source code") { - ProcessBuilder pb = new ProcessBuilder("go", "fmt") + ProcessBuilder pb = new ProcessBuilder("go", "fmt", "-x") .inheritIO() .directory(new File("./pkg/fusionauth/")) @@ -47,6 +54,13 @@ target(name: "format", description: "Formats the source code") { } target(name: "compile", description: "Compiles the source code", dependsOn: ["format"]) { + ProcessBuilder pb = new ProcessBuilder("go", "build", "-v", "-x") + .inheritIO() + .directory(new File("./pkg/fusionauth/")) + + def process = pb.start() + process.consumeProcessOutput(System.out, System.err) + process.waitFor() } target(name: "test", description: "Runs the project's unit tests", dependsOn: ["compile"]) { From 0a5ba074abbfa5f2e2a7b0dfd2f52ec96df2fc55 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:22:19 -0600 Subject: [PATCH 02/22] Builds and tests the golang client library --- .github/workflows/build.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..5d2d6f4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,23 @@ +# This is a starting workflow for building with GitHub Actions +name: Build + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Check out code + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + + # Compile + - name: Test that we can compile + run: cd pkg/fusionauth && go build + # Compile + - name: Run tests + run: cd pkg/fusionauth && go test + # Done! From 44a8a17bb85071dddb158fa1cd1e4c2500332104 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:27:40 -0600 Subject: [PATCH 03/22] stand up fusionauth so that tests can pass --- .github/kickstart/css/styles.css | 1102 ++++++++++++++++++++++++++++++ .github/kickstart/kickstart.json | 137 ++++ .github/workflows/build.yaml | 9 + 3 files changed, 1248 insertions(+) create mode 100644 .github/kickstart/css/styles.css create mode 100644 .github/kickstart/kickstart.json diff --git a/.github/kickstart/css/styles.css b/.github/kickstart/css/styles.css new file mode 100644 index 0000000..4ba979e --- /dev/null +++ b/.github/kickstart/css/styles.css @@ -0,0 +1,1102 @@ +:root { + --main-text-color: #424242; + --main-accent-color: #096324; + --input-background: #fbfbfb; + --body-background: #f7f7f7; + --tooltip-background: #e2e2e2; + --error-color: #ff0000; + --error-background: #ffe8e8; + --border-color: #dddddd; + --logo-url: url(https://fusionauth.io/cdn/samplethemes/changebank/changebank.svg); + --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + } + body { + font-family: var(--font-stack); + font-size: 16px; + color: var(--main-text-color); + background: var(--body-background); + line-height: normal; + } + .page-body:before { + content: ''; + display: block; + width: 80%; + max-width: 20rem; + height: 3.5rem; + margin: 0 auto 3rem auto; + background-image: var(--logo-url); + background-size: contain; + background-position: center; + background-repeat: no-repeat; + } + + /* Changes for Powered by FusionAuth div */ + body > main main.page-body { + min-height: calc(100vh - 3rem); /* to make the Powered by FusionAuth div position at the bottom of the page if the page is shorter than the viewport */ + padding-top: 3rem; + } + body > main { + padding-bottom: 2.5rem; /* giving Powered by FusionAuth more space */ + } + #powered-by-fa { + position: absolute !important; + } + /* End Powered by FusionAuth */ + + + /* Hiding help bar at top */ + body > main { + padding-top: 0; + } + /* end help bar */ + + + /* Typical typography */ + h1, h2, h3, h4, h5, h6 { + line-height: normal; + } + p { + margin: 1.5em 0; + line-height: 1.375; + } + /* End typography */ + + + /* Typical Buttons and Links */ + a { + color: var(--main-accent-color); + text-decoration: underline; + } + a:hover { + color: var(--main-accent-color); + opacity: .8; + } + a:visited { + color: var(--main-accent-color); + } + .blue-text { + color: var(--main-accent-color) !important; + } + .form-row:last-of-type { + margin-bottom: 0; + } + .button { + font-size: 1.125rem !important; + border-radius: .5rem; + padding: 1rem !important; + line-height: normal !important; + letter-spacing: normal !important; + } + .button.blue { + background: var(--main-accent-color) !important; + width: 100%; + margin-top: 2.5rem; + } + .button.blue:hover { + opacity: .8 !important; + background: var(--main-accent-color) !important; + } + .button.blue:focus { + background: var(--main-accent-color) !important; + box-shadow: inset 0 1px 2px rgba(0,0,0,0.4),0 0 0 2px rgba(57,152,219,0.4); + outline: 1px solid #ffffff !important; + } + .button.blue > .fa { + display: none; + } + .secondary-btn, + main.page-body .row:last-of-type a { + text-decoration: none; + padding: .5em .75em; + border: 1px solid var(--main-accent-color); + border-radius: .25em; + font-size: .75rem; + margin-top: .7rem; + display: inline-block; + line-height: normal; + } + .button + a { + text-align: center; + display: block; + margin: 1em auto; + } + /* End buttons and links */ + + + /* Typical Form panel and inputs */ + .panel { + box-shadow: 0 0 1.5625rem 1.25rem rgba(234, 234, 234, 0.8); + border-radius: .625rem; + border: none; + padding: 2.25rem 2.75rem; + } + .panel h2, + fieldset legend, + legend { + text-align: center; + color: var(--main-accent-color); + font-size: 1.5625rem; + font-weight: 600; + margin: 0 0 2rem 0; + padding: 0; + border: none; + } + legend { + border: none; + width: auto; + } + form .form-row { + margin-bottom: 1.25rem; + } + label { + color: var(--main-text-color); + font-size: 1rem; + font-weight: 500; + } + label.radio, + label.checkbox { + margin: 1rem 0; + font-weight: 400; + } + .input-addon-group, + .input-addon-group > :last-child:not(.flat), + .input-addon-group > .input:last-child:not(.flat), + .input-addon-group > input:last-child:not(.flat) { + color: var(--main-text-color); /* overriding typical text color for inputs */ + } + .input-addon-group span { + display: none; /* Hiding icons on inputs */ + } + input::placeholder { + color: var(--main-text-color); + } + .input, + input[type="email"], + input[type="file"], + input[type="number"], + input[type="search"], + input[type="text"], + input[type="tel"], + input[type="url"], + input[type="password"], + textarea, + label.select select + { + background: var(--input-background); + border: 1px solid var(--border-color) !important; + border-radius: .25rem !important; + box-shadow: none; + font-size: 1rem; + padding: 1em .625em; + } + input:focus, + input:active, + textarea:focus, + textarea:active { + border: 1px solid #707070 !important; + box-shadow: none !important; + } + .radio input { + width: 1.3125rem; + height: 1.3125rem; + } + .radio span.box, + .checkbox span.box { + width: 1.3125rem; + height: 1.3125rem; + margin: 0; + border: solid 1px var(--border-color); + background-color: var(--input-background); + } + .radio span.box { + border-radius: 50%; + } + .radio input:checked + span.box { + border: 2px solid var(--main-accent-color); + } + .radio span.box::after { + box-shadow: none; + border-radius: 50%; + background: var(--main-accent-color); + width: .8125rem; + height: .8125rem; + top: .125rem; + left: .125rem; + } + .radio span.box:hover::after { + opacity: 0; + } + .radio span.label, + .checkbox span.label { + margin-left: .5rem; + } + .radio-items .form-row label span:last-of-type { + border-color: var(--border-color); + } + input[type="radio"] { + width: 1.3125rem; + height: 1.3125rem; + margin: 0; + border: solid 1px var(--border-color); + border-radius: 50%; + background-color: var(--input-background); + appearance: none; + -webkit-appearance: none; + vertical-align: text-bottom; + } + input[type="radio"]:focus, + input[type="radio"]:active, + input[type="radio"]:checked { + border: 2px solid var(--main-accent-color) !important; + } + input[type="radio"]:checked:after { + content: ''; + box-shadow: none; + border-radius: 50%; + background: var(--main-accent-color); + width: .8125rem; + height: .8125rem; + top: .125rem; + left: .125rem; + position: absolute; + } + .checkbox span.box { + border-radius: .25rem; + } + .checkbox input:checked + span.box { + background: var(--main-accent-color); + border-color: var(--main-accent-color); + } + .checkbox span.box::after { + height: .25rem; + left: .25rem; + top: .3125rem; + transform: rotate(-46deg); + width: .625rem; + box-shadow: none; + } + .checkbox-list { + background: transparent; + border: none; + box-shadow: none; + padding-left: 0; + } + input[type="checkbox"] { + width: 1.3125rem; + height: 1.3125rem; + margin: 0; + border: solid 1px var(--border-color); + border-radius: .25rem; + background-color: var(--input-background); + appearance: none; + -webkit-appearance: none; + vertical-align: text-bottom; + } + input[type="checkbox"]:checked { + background-color: var(--main-accent-color); + } + input[type="checkbox"]:checked:after { + content: ''; + background: transparent; + border: 2px solid #fff; + border-right: none; + border-top: none; + height: .25rem; + left: .25rem; + top: .3125rem; + transform: rotate(-46deg); + width: .625 rem; + display: block; + position: absolute; + } + label.select select { + color: var(--main-text-color); + } + label.select select option { + background: var(--input-background); + color: var(--main-text-color); + } + /* End Panel and Form Inputs */ + + + /* Errors */ + body .alert { + color: var(--main-text-color); + } + body .alert a { + height: auto; + width: auto; + } + body .alert.error a i.fa { + color: var(--error-color); + } + body .alert.error { + border: 1px solid var(--error-color); + margin: 0 0 2rem 0; + background: var(--error-background); + box-shadow: none; + border-radius: .25rem; + } + body .alert .dismiss-button i { + margin: 0; + } + .error { + font-size: .75rem; + margin: .5em 0; + } + label.error { + color: var(--error-color); + font-size: inherit; + } + form .form-row span.error { + color: var(--error-color); + } + input.error { + background: var(--error-background); + border-color: var(--error-color) !important; + } + /* End Errors */ + + + /* Tooltip */ + .tooltip { + background: var(--tooltip-background); + font-size: .75rem; + color: var(--main-text-color); + text-align: left; + } + .tooltip:after { + border-top-color: var(--tooltip-background); + } + .tooltip.inverted:before { + border-bottom-color: var(--tooltip-background); + } + .fa-info-circle { + color: var(--main-accent-color) !important; + } + /* End Tooltip */ + + + table thead tr th { + color: var(--main-text-color); + } + table thead tr { + border-color: var(--border-color); + } + #locale-select { + width: 50%; + min-width: 10rem; + } + .grecaptcha-msg { + margin: 1rem 0; + text-align: left; + } + .progress-bar { + border-radius: .5rem; + border: 1px solid var(--border-color); + height: 1rem; + } + .progress-bar div { + border-radius: .5rem; + background: var(--main-accent-color); + height: 1rem; + } + hr, + .hr-container hr { + border: none; + height: 1px; + background-color: #979797; + } + .hr-container div { + color: #959595; + font-size: .75rem; + } + .page-body > .row.center:last-of-type { + width: calc(100% - 30px); + margin: auto; + justify-content: space-between; + } + .page-body > .row.center:last-of-type > div { + width: 50%; + margin: 0; + } + @media only screen and (max-width: 450px) { + .page-body > .row.center:last-of-type { + flex-direction: column-reverse; + align-items: center; + } + .secondary-btn, main.page-body .row:last-of-type a { + margin-bottom: 1rem; + } + .page-body > .row.center:last-of-type > div { + text-align: center !important; + } + } + @media only screen and (min-width: 768px) { + .page-body > .row.center:last-of-type { + width: 33rem; + } + } + + /* Overriding existing grid per page */ + #oauth-register .page-body > .row > .col-xs, + #oauth-register .page-body > .row > .col-sm-8, + #oauth-register .page-body > .row > .col-md-6, + #oauth-register .page-body > .row > .col-lg-5, + #oauth-register .page-body > .row > .col-xl-4, + #oauth-authorize .page-body > .row > .col-xs, + #oauth-authorize .page-body > .row > .col-sm-8, + #oauth-authorize .page-body > .row > .col-md-6, + #oauth-authorize .page-body > .row > .col-lg-5, + #oauth-authorize .page-body > .row > .col-xl-4, + #oauth-passwordless .page-body > .row > .col-xs, + #oauth-passwordless .page-body > .row > .col-sm-8, + #oauth-passwordless .page-body > .row > .col-md-6, + #oauth-passwordless .page-body > .row > .col-lg-5, + #oauth-passwordless .page-body > .row > .col-xl-4, + #oauth-two-factor .page-body > .row > .col-xs, + #oauth-two-factor .page-body > .row > .col-sm-8, + #oauth-two-factor .page-body > .row > .col-md-6, + #oauth-two-factor .page-body > .row > .col-lg-5, + #oauth-two-factor .page-body > .row > .col-xl-4, + #oauth-two-factor-methods .page-body > .row > .col-xs, + #oauth-two-factor-methods .page-body > .row > .col-sm-8, + #oauth-two-factor-methods .page-body > .row > .col-md-6, + #oauth-two-factor-methods .page-body > .row > .col-lg-5, + #oauth-two-factor-methods .page-body > .row > .col-xl-4, + #oauth-logout .page-body > .row > .col-xs, + #oauth-logout .page-body > .row > .col-sm-8, + #oauth-logout .page-body > .row > .col-md-6, + #oauth-logout .page-body > .row > .col-lg-5, + #oauth-logout .page-body > .row > .col-xl-4, + #oauth-device .page-body > .row > .col-xs, + #oauth-device .page-body > .row > .col-sm-8, + #oauth-device .page-body > .row > .col-md-6, + #oauth-device .page-body > .row > .col-lg-5, + #oauth-device .page-body > .row > .col-xl-4, + #oauth-device-complete .page-body > .row > .col-xs, + #oauth-device-complete .page-body > .row > .col-sm-8, + #oauth-device-complete .page-body > .row > .col-md-6, + #oauth-device-complete .page-body > .row > .col-lg-5, + #oauth-device-complete .page-body > .row > .col-xl-4, + #oauth-complete-reg .page-body > .row > .col-xs, + #oauth-complete-reg .page-body > .row > .col-sm-8, + #oauth-complete-reg .page-body > .row > .col-md-6, + #oauth-complete-reg .page-body > .row > .col-lg-5, + #oauth-complete-reg .page-body > .row > .col-xl-4, + #oauth-child-reg .page-body > .row > .col-xs, + #oauth-child-reg .page-body > .row > .col-sm-8, + #oauth-child-reg .page-body > .row > .col-md-6, + #oauth-child-reg .page-body > .row > .col-lg-5, + #oauth-child-reg .page-body > .row > .col-xl-4, + #oauth-child-reg-complete .page-body > .row > .col-xs, + #oauth-child-reg-complete .page-body > .row > .col-sm-8, + #oauth-child-reg-complete .page-body > .row > .col-md-6, + #oauth-child-reg-complete .page-body > .row > .col-lg-5, + #oauth-child-reg-complete .page-body > .row > .col-xl-4, + #oauth-not-registered .page-body > .row > .col-xs, + #oauth-not-registered .page-body > .row > .col-sm-8, + #oauth-not-registered .page-body > .row > .col-md-6, + #oauth-not-registered .page-body > .row > .col-lg-5, + #oauth-not-registered .page-body > .row > .col-xl-4, + #oauth-error .page-body > .row > .col-xs, + #oauth-error .page-body > .row > .col-sm-8, + #oauth-error .page-body > .row > .col-md-6, + #oauth-error .page-body > .row > .col-lg-5, + #oauth-error .page-body > .row > .col-xl-4, + #oauthstart-idp-link .page-body > .row > .col-xs, + #oauthstart-idp-link .page-body > .row > .col-sm-8, + #oauthstart-idp-link .page-body > .row > .col-md-6, + #oauthstart-idp-link .page-body > .row > .col-lg-5, + #oauthstart-idp-link .page-body > .row > .col-xl-4, + #oauth-wait .page-body > .row > .col-xs, + #oauth-wait .page-body > .row > .col-sm-8, + #oauth-wait .page-body > .row > .col-md-6, + #oauth-wait .page-body > .row > .col-lg-5, + #oauth-wait .page-body > .row > .col-xl-4, + #email-verification .page-body > .row > .col-xs, + #email-verification .page-body > .row > .col-sm-8, + #email-verification .page-body > .row > .col-md-6, + #email-verification .page-body > .row > .col-lg-5, + #email-verification .page-body > .row > .col-xl-4, + #email-ver-required .page-body > .row > .col-xs, + #email-ver-required .page-body > .row > .col-sm-8, + #email-ver-required .page-body > .row > .col-md-6, + #email-ver-required .page-body > .row > .col-lg-5, + #email-ver-required .page-body > .row > .col-xl-4, + #email-ver-complete .page-body > .row > .col-xs, + #email-ver-complete .page-body > .row > .col-sm-8, + #email-ver-complete .page-body > .row > .col-md-6, + #email-ver-complete .page-body > .row > .col-lg-5, + #email-ver-complete .page-body > .row > .col-xl-4, + #email-ver-resent .page-body > .row > .col-xs, + #email-ver-resent .page-body > .row > .col-sm-8, + #email-ver-resent .page-body > .row > .col-md-6, + #email-ver-resent .page-body > .row > .col-lg-5, + #email-ver-resent .page-body > .row > .col-xl-4, + #forgot-pwd .page-body > .row > .col-xs, + #forgot-pwd .page-body > .row > .col-sm-8, + #forgot-pwd .page-body > .row > .col-md-6, + #forgot-pwd .page-body > .row > .col-lg-5, + #forgot-pwd .page-body > .row > .col-xl-4, + #forgot-pwd-sent .page-body > .row > .col-xs, + #forgot-pwd-sent .page-body > .row > .col-sm-8, + #forgot-pwd-sent .page-body > .row > .col-md-6, + #forgot-pwd-sent .page-body > .row > .col-lg-5, + #forgot-pwd-sent .page-body > .row > .col-xl-4, + #verify-reg .page-body > .row > .col-xs, + #verify-reg .page-body > .row > .col-sm-8, + #verify-reg .page-body > .row > .col-md-6, + #verify-reg .page-body > .row > .col-lg-5, + #verify-reg .page-body > .row > .col-xl-4, + #verify-reg-complete .page-body > .row > .col-xs, + #verify-reg-complete .page-body > .row > .col-sm-8, + #verify-reg-complete .page-body > .row > .col-md-6, + #verify-reg-complete .page-body > .row > .col-lg-5, + #verify-reg-complete .page-body > .row > .col-xl-4, + #verify-reg-resent .page-body > .row > .col-xs, + #verify-reg-resent .page-body > .row > .col-sm-8, + #verify-reg-resent .page-body > .row > .col-md-6, + #verify-reg-resent .page-body > .row > .col-lg-5, + #verify-reg-resent .page-body > .row > .col-xl-4, + #verify-reg-required .page-body > .row > .col-xs, + #verify-reg-required .page-body > .row > .col-sm-8, + #verify-reg-required .page-body > .row > .col-md-6, + #verify-reg-required .page-body > .row > .col-lg-5, + #verify-reg-required .page-body > .row > .col-xl-4, + #acct-2fa-enable .page-body > .row > .col-xs-12, + #acct-2fa-enable .page-body > .row > .col-sm-12, + #acct-2fa-enable .page-body > .row > .col-md-10, + #acct-2fa-enable .page-body > .row > .col-lg-8, + #acct-2fa-disable .page-body > .row > .col-xs-12, + #acct-2fa-disable .page-body > .row > .col-sm-12, + #acct-2fa-disable .page-body > .row > .col-md-10, + #acct-2fa-disable .page-body > .row > .col-lg-8, + #unauthorized-page .page-body > .row > .col-sm-10, + #unauthorized-page .page-body > .row > .col-md-8, + #unauthorized-page .page-body > .row > .col-lg-7, + #unauthorized-page .page-body > .row > .col-xl-5, + #change-pwd .page-body > .row > .col-xs, + #change-pwd .page-body > .row > .col-sm-8, + #change-pwd .page-body > .row > .col-md-6, + #change-pwd .page-body > .row > .col-lg-5, + #change-pwd .page-body > .row > .col-xl-4, + #change-pwd-complete .page-body > .row > .col-xs, + #change-pwd-complete .page-body > .row > .col-sm-8, + #change-pwd-complete .page-body > .row > .col-md-6, + #change-pwd-complete .page-body > .row > .col-lg-5, + #change-pwd-complete .page-body > .row > .col-xl-4 { + flex-basis: 33rem; + width: calc(100% - 30px); + max-width: 33rem; + } + @media only screen and (max-width: 575px) { + #oauth-register .page-body > .row > .col-xs, + #oauth-register .page-body > .row > .col-sm-8, + #oauth-register .page-body > .row > .col-md-6, + #oauth-register .page-body > .row > .col-lg-5, + #oauth-register .page-body > .row > .col-xl-4, + #oauth-authorize .page-body > .row > .col-xs, + #oauth-authorize .page-body > .row > .col-sm-8, + #oauth-authorize .page-body > .row > .col-md-6, + #oauth-authorize .page-body > .row > .col-lg-5, + #oauth-authorize .page-body > .row > .col-xl-4, + #oauth-passwordless .page-body > .row > .col-xs, + #oauth-passwordless .page-body > .row > .col-sm-8, + #oauth-passwordless .page-body > .row > .col-md-6, + #oauth-passwordless .page-body > .row > .col-lg-5, + #oauth-passwordless .page-body > .row > .col-xl-4, + #oauth-two-factor .page-body > .row > .col-xs, + #oauth-two-factor .page-body > .row > .col-sm-8, + #oauth-two-factor .page-body > .row > .col-md-6, + #oauth-two-factor .page-body > .row > .col-lg-5, + #oauth-two-factor .page-body > .row > .col-xl-4, + #oauth-two-factor-methods .page-body > .row > .col-xs, + #oauth-two-factor-methods .page-body > .row > .col-sm-8, + #oauth-two-factor-methods .page-body > .row > .col-md-6, + #oauth-two-factor-methods .page-body > .row > .col-lg-5, + #oauth-two-factor-methods .page-body > .row > .col-xl-4, + #oauth-logout .page-body > .row > .col-xs, + #oauth-logout .page-body > .row > .col-sm-8, + #oauth-logout .page-body > .row > .col-md-6, + #oauth-logout .page-body > .row > .col-lg-5, + #oauth-logout .page-body > .row > .col-xl-4, + #oauth-device .page-body > .row > .col-xs, + #oauth-device .page-body > .row > .col-sm-8, + #oauth-device .page-body > .row > .col-md-6, + #oauth-device .page-body > .row > .col-lg-5, + #oauth-device .page-body > .row > .col-xl-4, + #oauth-device-complete .page-body > .row > .col-xs, + #oauth-device-complete .page-body > .row > .col-sm-8, + #oauth-device-complete .page-body > .row > .col-md-6, + #oauth-device-complete .page-body > .row > .col-lg-5, + #oauth-device-complete .page-body > .row > .col-xl-4, + #oauth-complete-reg .page-body > .row > .col-xs, + #oauth-complete-reg .page-body > .row > .col-sm-8, + #oauth-complete-reg .page-body > .row > .col-md-6, + #oauth-complete-reg .page-body > .row > .col-lg-5, + #oauth-complete-reg .page-body > .row > .col-xl-4, + #oauth-child-reg .page-body > .row > .col-xs, + #oauth-child-reg .page-body > .row > .col-sm-8, + #oauth-child-reg .page-body > .row > .col-md-6, + #oauth-child-reg .page-body > .row > .col-lg-5, + #oauth-child-reg .page-body > .row > .col-xl-4, + #oauth-child-reg-complete .page-body > .row > .col-xs, + #oauth-child-reg-complete .page-body > .row > .col-sm-8, + #oauth-child-reg-complete .page-body > .row > .col-md-6, + #oauth-child-reg-complete .page-body > .row > .col-lg-5, + #oauth-child-reg-complete .page-body > .row > .col-xl-4, + #oauth-not-registered .page-body > .row > .col-xs, + #oauth-not-registered .page-body > .row > .col-sm-8, + #oauth-not-registered .page-body > .row > .col-md-6, + #oauth-not-registered .page-body > .row > .col-lg-5, + #oauth-not-registered .page-body > .row > .col-xl-4, + #oauth-error .page-body > .row > .col-xs, + #oauth-error .page-body > .row > .col-sm-8, + #oauth-error .page-body > .row > .col-md-6, + #oauth-error .page-body > .row > .col-lg-5, + #oauth-error .page-body > .row > .col-xl-4, + #oauthstart-idp-link .page-body > .row > .col-xs, + #oauthstart-idp-link .page-body > .row > .col-sm-8, + #oauthstart-idp-link .page-body > .row > .col-md-6, + #oauthstart-idp-link .page-body > .row > .col-lg-5, + #oauthstart-idp-link .page-body > .row > .col-xl-4, + #oauth-wait .page-body > .row > .col-xs, + #oauth-wait .page-body > .row > .col-sm-8, + #oauth-wait .page-body > .row > .col-md-6, + #oauth-wait .page-body > .row > .col-lg-5, + #oauth-wait .page-body > .row > .col-xl-4, + #email-verification .page-body > .row > .col-xs, + #email-verification .page-body > .row > .col-sm-8, + #email-verification .page-body > .row > .col-md-6, + #email-verification .page-body > .row > .col-lg-5, + #email-verification .page-body > .row > .col-xl-4, + #email-ver-required .page-body > .row > .col-xs, + #email-ver-required .page-body > .row > .col-sm-8, + #email-ver-required .page-body > .row > .col-md-6, + #email-ver-required .page-body > .row > .col-lg-5, + #email-ver-required .page-body > .row > .col-xl-4, + #email-ver-complete .page-body > .row > .col-xs, + #email-ver-complete .page-body > .row > .col-sm-8, + #email-ver-complete .page-body > .row > .col-md-6, + #email-ver-complete .page-body > .row > .col-lg-5, + #email-ver-complete .page-body > .row > .col-xl-4, + #email-ver-resent .page-body > .row > .col-xs, + #email-ver-resent .page-body > .row > .col-sm-8, + #email-ver-resent .page-body > .row > .col-md-6, + #email-ver-resent .page-body > .row > .col-lg-5, + #email-ver-resent .page-body > .row > .col-xl-4, + #forgot-pwd .page-body > .row > .col-xs, + #forgot-pwd .page-body > .row > .col-sm-8, + #forgot-pwd .page-body > .row > .col-md-6, + #forgot-pwd .page-body > .row > .col-lg-5, + #forgot-pwd .page-body > .row > .col-xl-4, + #forgot-pwd-sent .page-body > .row > .col-xs, + #forgot-pwd-sent .page-body > .row > .col-sm-8, + #forgot-pwd-sent .page-body > .row > .col-md-6, + #forgot-pwd-sent .page-body > .row > .col-lg-5, + #forgot-pwd-sent .page-body > .row > .col-xl-4, + #verify-reg .page-body > .row > .col-xs, + #verify-reg .page-body > .row > .col-sm-8, + #verify-reg .page-body > .row > .col-md-6, + #verify-reg .page-body > .row > .col-lg-5, + #verify-reg .page-body > .row > .col-xl-4, + #verify-reg-complete .page-body > .row > .col-xs, + #verify-reg-complete .page-body > .row > .col-sm-8, + #verify-reg-complete .page-body > .row > .col-md-6, + #verify-reg-complete .page-body > .row > .col-lg-5, + #verify-reg-complete .page-body > .row > .col-xl-4, + #verify-reg-resent .page-body > .row > .col-xs, + #verify-reg-resent .page-body > .row > .col-sm-8, + #verify-reg-resent .page-body > .row > .col-md-6, + #verify-reg-resent .page-body > .row > .col-lg-5, + #verify-reg-resent .page-body > .row > .col-xl-4, + #verify-reg-required .page-body > .row > .col-xs, + #verify-reg-required .page-body > .row > .col-sm-8, + #verify-reg-required .page-body > .row > .col-md-6, + #verify-reg-required .page-body > .row > .col-lg-5, + #verify-reg-required .page-body > .row > .col-xl-4, + #acct-2fa-enable .page-body > .row > .col-xs-12, + #acct-2fa-enable .page-body > .row > .col-sm-12, + #acct-2fa-enable .page-body > .row > .col-md-10, + #acct-2fa-enable .page-body > .row > .col-lg-8, + #acct-2fa-disable .page-body > .row > .col-xs-12, + #acct-2fa-disable .page-body > .row > .col-sm-12, + #acct-2fa-disable .page-body > .row > .col-md-10, + #acct-2fa-disable .page-body > .row > .col-lg-8, + #unauthorized-page .page-body > .row > .col-sm-10, + #unauthorized-page .page-body > .row > .col-md-8, + #unauthorized-page .page-body > .row > .col-lg-7, + #unauthorized-page .page-body > .row > .col-xl-5, + #change-pwd .page-body > .row > .col-xs, + #change-pwd .page-body > .row > .col-sm-8, + #change-pwd .page-body > .row > .col-md-6, + #change-pwd .page-body > .row > .col-lg-5, + #change-pwd .page-body > .row > .col-xl-4, + #change-pwd-complete .page-body > .row > .col-xs, + #change-pwd-complete .page-body > .row > .col-sm-8, + #change-pwd-complete .page-body > .row > .col-md-6, + #change-pwd-complete .page-body > .row > .col-lg-5, + #change-pwd-complete .page-body > .row > .col-xl-4 { + flex-basis: calc(100% - 30px); + width: calc(100% - 30px); + max-width: 33rem; + } + .panel { + padding-left: .5rem; + padding-right: .5rem; + } + } + @media only screen and (min-width: 768px) { + #acct-2fa-index .page-body > .row.center:last-of-type { + width: calc(83.33333333% - 30px); + } + } + @media only screen and (min-width: 992px) { + #acct-2fa-index .page-body > .row > .col-xs12, + #acct-2fa-index .page-body > .row > .col-sm-12, + #acct-2fa-index .page-body > .row > .col-md-10, + #acct-2fa-index .page-body > .row > .col-lg-8 { + flex-basis: 54.125rem; + max-width: 54.125rem; + } + #acct-2fa-index .page-body > .row.center:last-of-type { + width: 54.125rem; + } + } + /* End grid override */ + + + /* Cleaning up spacing */ + #verify-reg-required .link.blue-text, + #verify-reg-required .grecaptcha-msg, + #verify-reg-required .panel > main > .full fieldset, + #verify-reg .grecaptcha-msg, + #verify-reg .panel > main > .full fieldset, + #email-ver-required .grecaptcha-msg, + #email-verification .grecaptcha-msg, + #email-ver-required fieldset, + #email-ver-required .panel > main > #verification-required-resend-code fieldset, + #oauth-two-factor .panel .full > fieldset, + #oauth-two-factor .panel > main > fieldset + .form-row, + #oauth-two-factor-methods .full, + #oauth-two-factor-methods .blue.button, + #oauth-authorize .panel > main > form > .form-row:first-of-type, + #oauth-passwordless .panel > main > .full > .form-row:first-of-type, + #oauth-register .panel > main > .full > .form-row:first-of-type, + #forgot-pwd .panel > main > .full fieldset, + #forgot-pwd .panel .grecaptcha-msg, + #change-pwd .panel > main .full > .form-row:first-of-type, + #acct-2fa-index .panel > main > fieldset { + margin-bottom: 0; + } + /* End spacing */ + + + /* Other page specific styles */ + + #acct-2fa-index .blue.button { + max-width: 25rem; + margin-left: auto; + margin-right: auto; + display: block; + } + #acct-2fa-index table { + margin-bottom: 3rem; + } + #acct-2fa-enable .d-flex { + display: block; + } + #acct-2fa-enable #qrcode { + padding-left: 0; + } + #acct-2fa-enable #qrcode img { + margin-left: auto; + margin-right: auto; + } + #acct-2fa-disable main > fieldset { + margin: 0; + } + #oauth-two-factor .panel form > .form-row:last-of-type a .fa { + display: none; /* hiding icon in button */ + } + #oauth-two-factor .panel > main > fieldset .form-row.mt-4 { + margin-top: 0; + } + #oauth-two-factor-methods input[type="radio"] { + vertical-align: text-top; + } + #oauth-two-factor-methods .full fieldset { + margin-top: 2rem; + margin-bottom: 0; + } + #oauth-two-factor-methods .full fieldset .form-row:last-child label { + padding-bottom: 0; + } + #oauth-two-factor-methods .radio-items .form-row label span:last-of-type { + margin-left: 1.875rem; + } + #oauth-device .push-top { + margin-top: 0; + } + #oauth-device #device-form > p { + text-align: center; + } + #oauth-device #user_code_container input[type="text"] { + color: var(--main-text-color); + } + #index-page ul li a { + font-family: var(--font-stack); + } + #oauth-passwordless .panel form .form-row:last-of-type p, + #oauth-register .panel form .form-row:last-of-type p, + #oauth-two-factor .panel form > .form-row:last-of-type, + #forgot-pwd .panel form > .form-row:last-of-type p, + #forgot-pwd-sent .panel main p:last-of-type, + #oauth-wait .panel main p:last-of-type { + margin-bottom: 0; + text-align: center; + } + + /* Account Index page */ + #acct-index .panel > main { + padding: 0; + } + #acct-index .user-details.mb-5 { + margin-bottom: 0; + } + #acct-index #edit-profile span { + font-size: inherit !important; + } + #acct-index #edit-profile span:after { + content: 'Edit'; + margin-left: .25em; + } + #acct-index .user-details > div { + margin: 0; + width: 100%; + max-width: 100%; + flex-basis: 100%; + } + #acct-index .user-details dl { + display: flex; + align-items: flex-start; + justify-content: space-between; + margin: 1.25rem 0; + } + #acct-index .user-details dt { + float: none; + font-weight: 500; + width: 40%; + margin: 0; + } + #acct-index .user-details dd { + width: 60%; + margin: 0; + } + #acct-index .panel { + padding-left: 1.5rem; + padding-right: 1.5rem; + } + #acct-index .panel:before { + content: ''; + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 4rem; + background-color: var(--main-accent-color); + border-radius: .625rem .625rem 0 0; + } + #acct-index .user-details .avatar > div:last-of-type { + color: var(--main-accent-color); + font-weight: 500; + font-size: 1.5rem; + } + #acct-index .user-details .avatar { + top: -2.25rem; + position: relative; + z-index: 2; + padding: 0; + } + #acct-index .user-details .avatar > div:first-of-type { + max-width: 7.5rem; + padding: 0; + } + #acct-index .user-details .avatar > div:first-of-type img { + border: .625rem solid #ffffff; + } + #acct-index .user-details > div:nth-of-type(2) > div { + padding: 0; + } + #acct-index .user-details > div:nth-of-type(2) > div > div { + margin: 0; + flex-basis: 100%; + width: 100%; + max-width: 100%; + } + #acct-index .user-details .panel-actions { + top: 3.5rem; + right: .25rem; + } + @media only screen and (max-width: 450px) { + #acct-index .user-details dl { + flex-direction: column; + } + #acct-index .user-details dt, + #acct-index .user-details dd { + width: 100%; + margin-bottom: .5em; + } + } + @media only screen and (min-width: 768px) { + #acct-index .panel:before { + width: 4rem; + height: 100%; + border-radius: .625rem 0 0 .625rem; + } + #acct-index .user-details { + display: block; + margin-left: 8rem; + } + #acct-index .user-details > div { + margin: 0; + width: 80%; + max-width: 80%; + } + #acct-index .user-details .avatar { + position: static; + } + #acct-index .user-details .avatar > div:first-of-type { + position: absolute; + left: .75rem; + top: calc(50% - 3.25rem); + width: 6.5rem; + } + #acct-index .user-details .avatar > div:first-of-type img { + border-width: .5rem; + } + #acct-index .user-details .avatar > div:last-of-type { + text-align: left; + } + #acct-index .user-details .panel-actions { + top: -0.25rem; + right: .5rem; + } + #acct-index .page-body > .row.center:last-of-type { + width: calc(83.33333333% - 30px); + } + } + @media only screen and (min-width: 992px) { + #acct-index .page-body > .row:first-of-type > .col-xs-12, + #acct-index .page-body > .row:first-of-type > .col-sm-12, + #acct-index .page-body > .row:first-of-type > .col-md-10, + #acct-index .page-body > .row:first-of-type > .col-lg-8 { + flex-basis: 54.125rem; + max-width: 54.125rem; + } + #acct-index .page-body > .row.center:last-of-type { + width: 54.125rem; + } + #acct-index .panel:before { + width: 6.25rem; + } + #acct-index .user-details { + margin-left: 13rem; + } + #acct-index .user-details .panel-actions { + padding: 0; + top: 2.25rem; + right: 2.25rem; + } + #acct-index .user-details .panel-actions .status, + #acct-index .user-details .panel-actions #edit-profile { + margin: 0; + } + #acct-index .user-details > div:first-of-type { + border: none; + width: auto; + flex-basis: auto; + } + #acct-index .user-details .avatar { + left: -.25rem; + } + #acct-index .user-details .avatar > div:first-of-type { + width: 8.75rem; + max-width: 8.75rem; + top: calc(50% - 4.5rem); + left: 1.875rem; + } + #acct-index .user-details .avatar > div:first-of-type img { + border-width: .75rem; + } + } + /*End Account Index page */ + + + /* specific page button/link overrides */ + #acct-2fa-enable .gray.button { + color: var(--main-accent-color) !important; + padding: .5em .75em !important; + border: 1px solid var(--main-accent-color) !important; + border-radius: .25em; + font-size: .75rem !important; + margin: 1rem auto; + display: block; + line-height: normal !important; + background: transparent !important; + } + #email-ver-required .link.blue-text { + display: block; + margin: 1rem auto; + text-decoration: underline; + } + #oauth-two-factor .panel form > .form-row:last-of-type a, + #verify-reg-required .panel .link.blue-text { + display: block; + margin: 1rem auto 0 auto; + text-decoration: underline; + } + #email-ver-required .link.blue-text .fa, + #verify-reg-required .panel .link.blue-text .fa { + display: none; /* hiding icon in link */ + } + #oauth-passwordless .panel form .form-row:last-of-type a, + #oauth-register .panel form .form-row:last-of-type a, + #forgot-pwd .panel form > .form-row:last-of-type a, + #forgot-pwd-sent .panel main p:last-of-type a, + #oauth-wait .panel main p:last-of-type a { + color: var(--main-accent-color) !important; + padding: .5em .75em; + border: 1px solid var(--main-accent-color) !important; + border-radius: .25em; + font-size: .75rem; + margin: 1rem auto 0 auto; + display: inline-block; + line-height: normal; + text-decoration: none; + } + #forgot-pwd-sent .panel main p:last-of-type a { + color: var(--main-accent-color) !important; + padding: .5em .75em; + border: 1px solid var(--main-accent-color) !important; + border-radius: .25em; + font-size: .75rem; + margin: 0 auto; + display: inline-block; + line-height: normal; + text-decoration: none; + } + #oauthstart-idp-link .blue.button { + height: auto !important; + margin-top: 0; + } + #oauthstart-idp-link .panel main div:last-of-type a { + display: block; + border: none; + margin-top: 0; + padding: 0; + } + /* End page specific buttons and links */ + diff --git a/.github/kickstart/kickstart.json b/.github/kickstart/kickstart.json new file mode 100644 index 0000000..65e8580 --- /dev/null +++ b/.github/kickstart/kickstart.json @@ -0,0 +1,137 @@ +{ + "variables": { + "apiKey": "af69486b-4733-4470-a592-f1bfce7af580", + "asymmetricKeyId": "#{UUID()}", + "applicationId": "e9fdb985-9173-4e01-9d73-ac2d60d1dc8e", + "clientSecret": "super-secret-secret-that-should-be-regenerated-for-production", + "newThemeId": "#{UUID()}", + "defaultTenantId": "d7d09513-a3f5-401c-9685-34ab6c552453", + "adminEmail": "admin@example.com", + "adminPassword": "password", + "adminUserId": "00000000-0000-0000-0000-000000000001", + "userEmail": "richard@example.com", + "userPassword": "password", + "userUserId": "00000000-0000-0000-0000-111111111111" + }, + "apiKeys": [ + { + "key": "#{apiKey}", + "description": "Unrestricted API key" + } + ], + "requests": [ + { + "method": "POST", + "url": "/api/key/generate/#{asymmetricKeyId}", + "tenantId": "#{defaultTenantId}", + "body": { + "key": { + "algorithm": "RS256", + "name": "For exampleapp", + "length": 2048 + } + } + }, + { + "method": "POST", + "url": "/api/application/#{applicationId}", + "tenantId": "#{defaultTenantId}", + "body": { + "application": { + "name": "ExampleNodeApp", + "oauthConfiguration": { + "authorizedRedirectURLs": [ + "http://localhost:8080/oauth-redirect" + ], + "logoutURL": "http://localhost:8080/oauth2/logout", + "clientSecret": "#{clientSecret}", + "enabledGrants": [ + "authorization_code", + "refresh_token" + ], + "generateRefreshTokens": true, + "requireRegistration": true + }, + "jwtConfiguration": { + "enabled": true, + "accessTokenKeyId": "#{asymmetricKeyId}", + "idTokenKeyId": "#{asymmetricKeyId}" + } + } + } + }, + { + "method": "POST", + "url": "/api/user/registration/#{adminUserId}", + "body": { + "registration": { + "applicationId": "#{FUSIONAUTH_APPLICATION_ID}", + "roles": [ + "admin" + ] + }, + "roles": [ + "admin" + ], + "skipRegistrationVerification": true, + "user": { + "birthDate": "1981-06-04", + "data": { + "favoriteColor": "chartreuse" + }, + "email": "#{adminEmail}", + "firstName": "Dinesh", + "lastName": "Chugtai", + "password": "#{adminPassword}" + } + } + }, + { + "method": "POST", + "url": "/api/user/registration/#{userUserId}", + "body": { + "user": { + "birthDate": "1985-11-23", + "email": "#{userEmail}", + "firstName": "Fred", + "lastName": "Flintstone", + "password": "#{userPassword}" + }, + "registration": { + "applicationId": "#{applicationId}", + "data": { + "favoriteColor": "turquoise" + } + } + } + }, + { + "method": "POST", + "url": "/api/theme/#{newThemeId}", + "body": { + "sourceThemeId": "75a068fd-e94b-451a-9aeb-3ddb9a3b5987", + "theme": { + "name": "React theme" + } + } + }, + { + "method": "PATCH", + "url": "/api/theme/#{newThemeId}", + "body": { + "theme": { + "stylesheet": "@{css/styles.css}" + } + } + }, + { + "method": "PATCH", + "url": "/api/tenant/#{defaultTenantId}", + "body": { + "tenant": { + "themeId": "#{newThemeId}" + } + } + } + ] +} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5d2d6f4..be6fa02 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,6 +13,15 @@ jobs: # Check out code - uses: actions/checkout@v4 - uses: actions/setup-go@v5 + # Set up the build environment + - name: Copy our kickstart file over so it gets picked up + run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json + - name: Start FusionAuth + uses: fusionauth/fusionauth-github-action@v1 + with: + FUSIONAUTH_VERSION: 1.48.3 + FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: kickstart + - name: Install npm dependencies # Compile - name: Test that we can compile From 6110305487b5f0eeae9ee18d47f5ee06443882ae Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:28:26 -0600 Subject: [PATCH 04/22] fix typo --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index be6fa02..fe2ea51 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,6 @@ jobs: with: FUSIONAUTH_VERSION: 1.48.3 FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: kickstart - - name: Install npm dependencies # Compile - name: Test that we can compile From 58e69c73e997666555e32d35f29f2ddd1cf01fae Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:29:18 -0600 Subject: [PATCH 05/22] corrected path to kickstart file --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe2ea51..fd71a4b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-go@v5 # Set up the build environment - name: Copy our kickstart file over so it gets picked up - run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json + run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json - name: Start FusionAuth uses: fusionauth/fusionauth-github-action@v1 with: From b6938fdc42ef5392015e7d52a22b5df008df5665 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:31:49 -0600 Subject: [PATCH 06/22] add passing test --- pkg/fusionauth/Client_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index ec80c41..208f55c 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -38,11 +38,16 @@ var ( var faClient = NewClient(httpClient, baseURL, "af69486b-4733-4470-a592-f1bfce7af580") -func TestRetrieveUser(t *testing.T) { +func TestRetrieveUserFail(t *testing.T) { userResponse, _, _ := faClient.RetrieveUser("missing@example.com") assert.Equal(t, 401, userResponse.StatusCode) } +func TestRetrieveUserSuccess(t *testing.T) { + userResponse, _, _ := faClient.RetrieveUser("richard@example.com") + assert.Equal(t, 200, userResponse.StatusCode) +} + func TestMain(m *testing.M) { os.Exit(m.Run()) } From 1ec87b50a863e52a341a940a3dbf391a07b8dd0a Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:36:48 -0600 Subject: [PATCH 07/22] tweaked verison, location of kickstart file --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fd71a4b..77d8675 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,9 +19,9 @@ jobs: - name: Start FusionAuth uses: fusionauth/fusionauth-github-action@v1 with: - FUSIONAUTH_VERSION: 1.48.3 + FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json + FUSIONAUTH_VERSION: 1.51.1 FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: kickstart - # Compile - name: Test that we can compile run: cd pkg/fusionauth && go build From 176538f9a11e4c621634c5fa9efa35c8cb56206b Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:37:51 -0600 Subject: [PATCH 08/22] added in debugging --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 77d8675..c75bd92 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,6 +23,8 @@ jobs: FUSIONAUTH_VERSION: 1.51.1 FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: kickstart # Compile + - name: Debugging network info + run: docker network ls - name: Test that we can compile run: cd pkg/fusionauth && go build # Compile From 6d60942e33c5bc47a594e6f5e3761e49efd2b439 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:41:04 -0600 Subject: [PATCH 09/22] debugging --- .github/workflows/build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c75bd92..f83eea6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,10 +21,11 @@ jobs: with: FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json FUSIONAUTH_VERSION: 1.51.1 - FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: kickstart - # Compile + FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart + - name: Debugging network info run: docker network ls + # Compile - name: Test that we can compile run: cd pkg/fusionauth && go build # Compile From 7af3f253d4722aee308dab1f0a823ce3aec5e969 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:42:10 -0600 Subject: [PATCH 10/22] debugging --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f83eea6..fe891a4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-go@v5 # Set up the build environment - name: Copy our kickstart file over so it gets picked up - run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json + run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json && cp .github/kickstart/kickstart.json .github/kickstart/k2.json - name: Start FusionAuth uses: fusionauth/fusionauth-github-action@v1 with: From 9a8e47abf13b384bb929268227110abf7cb26b63 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:43:37 -0600 Subject: [PATCH 11/22] debugging --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe891a4..413e1a7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,6 +23,8 @@ jobs: FUSIONAUTH_VERSION: 1.51.1 FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart + - name: Sleeping until FusionAuth starts + run: sleep 30 - name: Debugging network info run: docker network ls # Compile From 531a34712c2fa63cf3f124fd4c6d0a9966b7de7a Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:55:21 -0600 Subject: [PATCH 12/22] more error reporting --- pkg/fusionauth/Client_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index 208f55c..1b9ee83 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -16,6 +16,8 @@ package fusionauth import ( + "fmt" + "encoding/json" "net/http" "net/url" "os" @@ -39,12 +41,23 @@ var ( var faClient = NewClient(httpClient, baseURL, "af69486b-4733-4470-a592-f1bfce7af580") func TestRetrieveUserFail(t *testing.T) { - userResponse, _, _ := faClient.RetrieveUser("missing@example.com") + userResponse, errors, _ := faClient.RetrieveUser("missing@example.com") + + errJson, _ := json.Marshal(errors) + fmt.Println(string(errJson)) + + assert.Equal(t, 0, len(errors.FieldErrors)) + assert.Equal(t, 0, len(errors.GeneralErrors)) assert.Equal(t, 401, userResponse.StatusCode) } func TestRetrieveUserSuccess(t *testing.T) { - userResponse, _, _ := faClient.RetrieveUser("richard@example.com") + userResponse, errors, _ := faClient.RetrieveUser("richard@example.com") + errJson, _ := json.Marshal(errors) + fmt.Println(string(errJson)) + + assert.Equal(t, 0, len(errors.FieldErrors)) + assert.Equal(t, 0, len(errors.GeneralErrors)) assert.Equal(t, 200, userResponse.StatusCode) } From 6d4af8bc74f5d6a0e61344cea1d71eb83aa9c42b Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:57:45 -0600 Subject: [PATCH 13/22] use proper function call --- pkg/fusionauth/Client_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index 1b9ee83..53e5d99 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -41,7 +41,7 @@ var ( var faClient = NewClient(httpClient, baseURL, "af69486b-4733-4470-a592-f1bfce7af580") func TestRetrieveUserFail(t *testing.T) { - userResponse, errors, _ := faClient.RetrieveUser("missing@example.com") + userResponse, errors, _ := faClient.RetrieveUserByEmail("missing@example.com") errJson, _ := json.Marshal(errors) fmt.Println(string(errJson)) @@ -52,7 +52,7 @@ func TestRetrieveUserFail(t *testing.T) { } func TestRetrieveUserSuccess(t *testing.T) { - userResponse, errors, _ := faClient.RetrieveUser("richard@example.com") + userResponse, errors, _ := faClient.RetrieveUserByEmail("richard@example.com") errJson, _ := json.Marshal(errors) fmt.Println(string(errJson)) From e3d52e4337558fd05c00290be8d66825cd87474f Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 13:59:52 -0600 Subject: [PATCH 14/22] fixing test --- pkg/fusionauth/Client_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index 53e5d99..8afb1d5 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -48,7 +48,7 @@ func TestRetrieveUserFail(t *testing.T) { assert.Equal(t, 0, len(errors.FieldErrors)) assert.Equal(t, 0, len(errors.GeneralErrors)) - assert.Equal(t, 401, userResponse.StatusCode) + assert.Equal(t, 404, userResponse.StatusCode) } func TestRetrieveUserSuccess(t *testing.T) { @@ -56,8 +56,7 @@ func TestRetrieveUserSuccess(t *testing.T) { errJson, _ := json.Marshal(errors) fmt.Println(string(errJson)) - assert.Equal(t, 0, len(errors.FieldErrors)) - assert.Equal(t, 0, len(errors.GeneralErrors)) + assert.Equal(t, nil, errors) assert.Equal(t, 200, userResponse.StatusCode) } From 16939767ebe35e1e701686a62357c18979d29898 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 14:03:54 -0600 Subject: [PATCH 15/22] corrected check for missing errors object --- pkg/fusionauth/Client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index 8afb1d5..8c76675 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -56,7 +56,7 @@ func TestRetrieveUserSuccess(t *testing.T) { errJson, _ := json.Marshal(errors) fmt.Println(string(errJson)) - assert.Equal(t, nil, errors) + assert.Equal(t, (*Errors)(nil), errors) assert.Equal(t, 200, userResponse.StatusCode) } From 43f5ef7f31938c8a1d51c73e1c308298b0f4d0dc Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 14:30:45 -0600 Subject: [PATCH 16/22] remove version so we always pick up latest --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 413e1a7..285453f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,6 @@ jobs: uses: fusionauth/fusionauth-github-action@v1 with: FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json - FUSIONAUTH_VERSION: 1.51.1 FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart - name: Sleeping until FusionAuth starts From 56db9cbd2c65dc634ae6cf5303485220d68b0501 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:28:19 -0600 Subject: [PATCH 17/22] run on new image --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 86e6617..f1b2cff 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ jobs: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' && inputs.command == 'test' - runs-on: fusionauth-builder + runs-on: fusionauth-standard steps: - name: checkout uses: actions/checkout@v4 From 2e291270250aba1133ae24813af8d860834f1aaf Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:30:30 -0600 Subject: [PATCH 18/22] formatted --- pkg/fusionauth/Client_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/fusionauth/Client_test.go b/pkg/fusionauth/Client_test.go index 8c76675..859d401 100644 --- a/pkg/fusionauth/Client_test.go +++ b/pkg/fusionauth/Client_test.go @@ -16,8 +16,8 @@ package fusionauth import ( - "fmt" - "encoding/json" + "encoding/json" + "fmt" "net/http" "net/url" "os" @@ -43,9 +43,9 @@ var faClient = NewClient(httpClient, baseURL, "af69486b-4733-4470-a592-f1bfce7af func TestRetrieveUserFail(t *testing.T) { userResponse, errors, _ := faClient.RetrieveUserByEmail("missing@example.com") - errJson, _ := json.Marshal(errors) - fmt.Println(string(errJson)) - + errJson, _ := json.Marshal(errors) + fmt.Println(string(errJson)) + assert.Equal(t, 0, len(errors.FieldErrors)) assert.Equal(t, 0, len(errors.GeneralErrors)) assert.Equal(t, 404, userResponse.StatusCode) @@ -53,9 +53,9 @@ func TestRetrieveUserFail(t *testing.T) { func TestRetrieveUserSuccess(t *testing.T) { userResponse, errors, _ := faClient.RetrieveUserByEmail("richard@example.com") - errJson, _ := json.Marshal(errors) - fmt.Println(string(errJson)) - + errJson, _ := json.Marshal(errors) + fmt.Println(string(errJson)) + assert.Equal(t, (*Errors)(nil), errors) assert.Equal(t, 200, userResponse.StatusCode) } From e12a3d07afcb684ac42609bba61005b2733eb770 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:31:58 -0600 Subject: [PATCH 19/22] merging in the sep workflow per internal discussion --- .github/workflows/build.yaml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 285453f..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# This is a starting workflow for building with GitHub Actions -name: Build - -on: - push: - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - # Check out code - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - # Set up the build environment - - name: Copy our kickstart file over so it gets picked up - run: mkdir faDockerComposeFilePath/ && cp -r .github/kickstart faDockerComposeFilePath/ && cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json && cp .github/kickstart/kickstart.json .github/kickstart/k2.json - - name: Start FusionAuth - uses: fusionauth/fusionauth-github-action@v1 - with: - FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json - FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart - - - name: Sleeping until FusionAuth starts - run: sleep 30 - - name: Debugging network info - run: docker network ls - # Compile - - name: Test that we can compile - run: cd pkg/fusionauth && go build - # Compile - - name: Run tests - run: cd pkg/fusionauth && go test - # Done! From 013de46516012315aacb9894445da124ea7a0179 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:32:04 -0600 Subject: [PATCH 20/22] merging in the sep workflow per internal discussion --- .github/workflows/deploy.yaml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f1b2cff..4a7fde9 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -36,13 +36,26 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - - name: compile - shell: bash -l {0} + - name: Copy our kickstart file over so it gets picked up run: | - echo "TODO: enable tests" - # We need an instance to run tests against before we can enable this. - # sb test + mkdir faDockerComposeFilePath + cp -r .github/kickstart faDockerComposeFilePath + cp .github/kickstart/kickstart.json faDockerComposeFilePath/kickstart/k2.json + cp .github/kickstart/kickstart.json .github/kickstart/k2.json + + - name: Start FusionAuth + uses: fusionauth/fusionauth-github-action@v1 + with: + FUSIONAUTH_APP_KICKSTART_FILENAME: k2.json + FUSIONAUTH_APP_KICKSTART_DIRECTORY_PATH: .github/kickstart + + - name: Sleep until FusionAuth starts + run: sleep 30 + + - name: Test that we can compile + run: sb compile + - name: Run tests + run: sb test deploy: if: | From 4ceb55c5989e19311bd0bc02cc725c69cf43ec13 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:38:28 -0600 Subject: [PATCH 21/22] corrected how we call savant --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4a7fde9..7fc0e58 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -51,10 +51,11 @@ jobs: - name: Sleep until FusionAuth starts run: sleep 30 - - name: Test that we can compile + shell: bash -l {0} run: sb compile - name: Run tests + shell: bash -l {0} run: sb test deploy: From 2ed2c0f7fbd104c1f8135bdbd0cf5d9c87c884dd Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 2 Jul 2024 15:39:39 -0600 Subject: [PATCH 22/22] reworking workflow --- .github/workflows/deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7fc0e58..e4aa707 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -36,6 +36,9 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 + - name: Test that we can compile + shell: bash -l {0} + run: sb compile - name: Copy our kickstart file over so it gets picked up run: | mkdir faDockerComposeFilePath @@ -51,9 +54,6 @@ jobs: - name: Sleep until FusionAuth starts run: sleep 30 - - name: Test that we can compile - shell: bash -l {0} - run: sb compile - name: Run tests shell: bash -l {0} run: sb test