@@ -37,6 +37,11 @@ import {ForbiddenError, FetchError, NotFoundError, SameOriginForbidd
3737
3838export const authSession = authSessionImport
3939
40+ const DEFAULT_ISSUERS = [
41+ 'https://solidcommunity.net' ,
42+ 'https://solidweb.org'
43+ ]
44+
4045// const userCheckSite = 'https://databox.me/'
4146
4247/**
@@ -869,16 +874,71 @@ function signInOrSignUpBox (
869874 if ( offline ) return setUserCallback ( offline . uri )
870875
871876 const thisUrl = new URL ( window . location . href ) . origin
872- // HACK solid-client-authn-js no longer comes with its own UI for selecting
873- // an IDP. This was the easiest way to get the user to select.
874- // TODO: make a nice UI to select an IDP
875- const issuer = prompt ( 'Enter an issuer' , thisUrl )
876- authSession . login ( {
877- // @ts -ignore this library requires a specific kind of URL that isn't global
878- redirectUrl : window . location . href ,
879- // @ts -ignore
880- oidcIssuer : issuer
877+ /**
878+ * Issuer Menu
879+ */
880+ const issuerPopup = dom . createElement ( 'div' )
881+ issuerPopup . setAttribute ( 'style' , 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;' )
882+ box . appendChild ( issuerPopup )
883+ const issuerPopupBox = dom . createElement ( 'div' )
884+ issuerPopupBox . setAttribute ( 'style' , `
885+ background-color: white;
886+ box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);
887+ -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);
888+ -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);
889+ -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);
890+ border-radius: 4px;
891+ min-width: 400px;
892+ padding: 10px;
893+ ` )
894+ issuerPopup . appendChild ( issuerPopupBox )
895+ const issuerPopupBoxTopMenu = dom . createElement ( 'div' )
896+ issuerPopupBoxTopMenu . setAttribute ( 'style' , `
897+ border-bottom: 1px solid #AAA;
898+ display: flex;
899+ flex-direction: row;
900+ align-items: center;
901+ justify-content: space-between;
902+ ` )
903+ issuerPopupBox . appendChild ( issuerPopupBoxTopMenu )
904+ const issuerPopupBoxLabel = dom . createElement ( 'label' )
905+ issuerPopupBoxLabel . setAttribute ( 'style' , 'margin-right: 5px' )
906+ issuerPopupBoxLabel . innerText = 'Select an identity provider'
907+ const issuerPopupBoxCloseButton = dom . createElement ( 'button' )
908+ issuerPopupBoxCloseButton . innerHTML = '<img src="https://solid.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">'
909+ issuerPopupBoxCloseButton . setAttribute ( 'style' , 'background-color: transparent; border: none;' )
910+ issuerPopupBoxCloseButton . addEventListener ( 'click' , ( ) => {
911+ issuerPopup . remove ( )
881912 } )
913+ issuerPopupBoxTopMenu . appendChild ( issuerPopupBoxLabel )
914+ issuerPopupBoxTopMenu . appendChild ( issuerPopupBoxCloseButton )
915+
916+ /**
917+ * Text-based idp selection
918+ */
919+ const issuerTextContainer = dom . createElement ( 'div' )
920+ issuerTextContainer . setAttribute ( 'style' , `
921+ border-bottom: 1px solid #AAA;
922+ display: flex;
923+ flex-direction: column;
924+ ` )
925+ const issuerTextLabel = dom . createElement ( 'label' )
926+ issuerTextLabel . innerText = 'Enter your WebID or the URL of your identity provider:'
927+ const issuerTextInput = dom . createElement ( 'input' )
928+ issuerTextInput . setAttribute ( 'type' , 'text' )
929+ const issuerTextGoButton = dom . createElement ( 'button' )
930+ issuerTextGoButton . innerText = 'Go'
931+ issuerTextContainer . appendChild ( issuerTextLabel )
932+ issuerTextContainer . appendChild ( issuerTextInput )
933+ issuerTextContainer . appendChild ( issuerTextGoButton )
934+ issuerPopupBox . appendChild ( issuerTextContainer )
935+
936+ // authSession.login({
937+ // // @ts -ignore this library requires a specific kind of URL that isn't global
938+ // redirectUrl: window.location.href,
939+ // // @ts -ignore
940+ // oidcIssuer: issuer,
941+ // })
882942 } , false )
883943
884944 // Sign up button
0 commit comments