Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
4f029a2b
Commit
4f029a2b
authored
May 20, 2021
by
michael.simon
Browse files
add more options to connect account bean
parent
3e7cb66b
Changes
2
Hide whitespace changes
Inline
Side-by-side
bwreg-webapp/src/main/java/edu/kit/scc/webreg/bean/ConnectAccountBean.java
View file @
4f029a2b
...
...
@@ -21,12 +21,14 @@ import javax.faces.context.FacesContext;
import
javax.faces.event.ComponentSystemEvent
;
import
javax.inject.Inject
;
import
edu.kit.scc.webreg.entity.SamlIdpMetadataEntity
;
import
edu.kit.scc.webreg.entity.UserEntity
;
import
edu.kit.scc.webreg.entity.identity.IdentityEntity
;
import
edu.kit.scc.webreg.entity.oidc.OidcRpConfigurationEntity
;
import
edu.kit.scc.webreg.service.UserService
;
import
edu.kit.scc.webreg.service.identity.IdentityService
;
import
edu.kit.scc.webreg.service.oidc.OidcRpConfigurationService
;
import
edu.kit.scc.webreg.service.saml.FederationSingletonBean
;
import
edu.kit.scc.webreg.session.SessionManager
;
import
edu.kit.scc.webreg.util.FacesMessageGenerator
;
...
...
@@ -48,6 +50,9 @@ public class ConnectAccountBean implements Serializable {
@Inject
private
OidcRpConfigurationService
oidcRpService
;
@Inject
private
FederationSingletonBean
federationBean
;
@Inject
private
FacesMessageGenerator
messageGenerator
;
...
...
@@ -56,6 +61,9 @@ public class ConnectAccountBean implements Serializable {
private
List
<
OidcRpConfigurationEntity
>
oidcRpList
;
private
OidcRpConfigurationEntity
selectedOidcRp
;
private
List
<
SamlIdpMetadataEntity
>
idpList
;
private
SamlIdpMetadataEntity
selectedIdp
;
private
String
pin
;
...
...
@@ -63,10 +71,12 @@ public class ConnectAccountBean implements Serializable {
if
(
identity
==
null
)
{
identity
=
identityService
.
findById
(
sessionManager
.
getIdentityId
());
userList
=
userService
.
findByIdentity
(
identity
);
idpList
=
federationBean
.
getAllIdpList
();
}
}
public
void
startConnect
()
{
public
void
startConnect
Oidc
()
{
ExternalContext
externalContext
=
FacesContext
.
getCurrentInstance
().
getExternalContext
();
if
(
selectedOidcRp
!=
null
&&
pin
!=
null
&&
pin
.
matches
(
"^[a-zA-Z0-9]{4,32}$"
))
{
...
...
@@ -86,6 +96,12 @@ public class ConnectAccountBean implements Serializable {
}
public
void
startConnectSaml
()
{
ExternalContext
externalContext
=
FacesContext
.
getCurrentInstance
().
getExternalContext
();
messageGenerator
.
addErrorMessage
(
"Ein Fehler ist aufgetreten"
,
"Fehler, nicht implementiert"
);
}
public
IdentityEntity
getIdentity
()
{
return
identity
;
}
...
...
@@ -117,4 +133,16 @@ public class ConnectAccountBean implements Serializable {
this
.
pin
=
pin
;
}
public
List
<
SamlIdpMetadataEntity
>
getIdpList
()
{
return
idpList
;
}
public
SamlIdpMetadataEntity
getSelectedIdp
()
{
return
selectedIdp
;
}
public
void
setSelectedIdp
(
SamlIdpMetadataEntity
selectedIdp
)
{
this
.
selectedIdp
=
selectedIdp
;
}
}
bwreg-webapp/src/main/webapp/user/connect-account.xhtml
View file @
4f029a2b
...
...
@@ -35,7 +35,24 @@
#{user.id}
</p:dataList>
<h:panelGrid
id=
"samlBaseData"
columns=
"3"
style=
"margin-top: 8px;"
>
<p:outputLabel
value=
"#{messages.home_org}:"
for=
"idpBox"
/>
<p:selectOneListbox
id=
"idpBox"
value=
"#{connectAccountBean.selectedIdp}"
scrollHeight=
"360"
style=
"width:auto;"
converter=
"#{samlIdpMetadataConverter}"
>
<f:selectItems
value=
"#{connectAccountBean.idpList}"
var=
"idp"
itemLabel=
"#{idp.displayName == null ? idp.orgName : idp.displayName}"
itemValue=
"#{idp}"
/>
<p:ajax
event=
"dblclick"
listener=
"#{connectAccountBean.login}"
update=
":form"
/>
</p:selectOneListbox>
<p:message
for=
"idpBox"
/>
</h:panelGrid>
<p:commandButton
id=
"samlLogin"
action=
"#{connectAccountBean.startConnectSaml()}"
value=
"#{messages.proceed}"
validateClient=
"true"
update=
":form"
/>
<h:panelGrid
id=
"oidcBaseData"
columns=
"3"
style=
"margin-top: 8px;"
>
<p:outputLabel
value=
"#{messages.home_org}:"
for=
"oidcBox"
/>
<p:selectOneListbox
id=
"oidcBox"
value=
"#{connectAccountBean.selectedOidcRp}"
scrollHeight=
"120"
style=
"width:300px;"
converter=
"#{oidcRpConfigurationConverter}"
>
...
...
@@ -52,7 +69,7 @@
<p:message
for=
"pinBox"
/>
</h:panelGrid>
<p:commandButton
id=
"oidcLogin"
action=
"#{connectAccountBean.startConnect()}"
value=
"#{messages.proceed}"
<p:commandButton
id=
"oidcLogin"
action=
"#{connectAccountBean.startConnect
Oidc
()}"
value=
"#{messages.proceed}"
validateClient=
"true"
update=
":form"
/>
</h:form>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment