Commit 44548d9a authored by michael.simon's avatar michael.simon
Browse files

Add federation filter per url to discover login bean

parent 7ddd74e5
...@@ -29,6 +29,9 @@ public class FederationEntity extends AbstractBaseEntity { ...@@ -29,6 +29,9 @@ public class FederationEntity extends AbstractBaseEntity {
@Column(name = "federation_name", length = 128, unique = true) @Column(name = "federation_name", length = 128, unique = true)
private String name; private String name;
@Column(name = "short_name", length = 128, unique = true)
private String shortName;
@Column(name = "entity_id", length = 2048) @Column(name = "entity_id", length = 2048)
private String entityId; private String entityId;
...@@ -169,4 +172,12 @@ public class FederationEntity extends AbstractBaseEntity { ...@@ -169,4 +172,12 @@ public class FederationEntity extends AbstractBaseEntity {
public void setAas(Set<SamlAAMetadataEntity> aas) { public void setAas(Set<SamlAAMetadataEntity> aas) {
this.aas = aas; this.aas = aas;
} }
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
} }
...@@ -68,6 +68,7 @@ public class SessionManager implements Serializable { ...@@ -68,6 +68,7 @@ public class SessionManager implements Serializable {
private String originalRequestPath; private String originalRequestPath;
private String originalIdpEntityId; private String originalIdpEntityId;
private String originalFederationShortName;
private Set<RoleEntity> roles; private Set<RoleEntity> roles;
private Long roleSetCreated; private Long roleSetCreated;
...@@ -362,4 +363,12 @@ public class SessionManager implements Serializable { ...@@ -362,4 +363,12 @@ public class SessionManager implements Serializable {
public void setAccountLinkingPin(String accountLinkingPin) { public void setAccountLinkingPin(String accountLinkingPin) {
this.accountLinkingPin = accountLinkingPin; this.accountLinkingPin = accountLinkingPin;
} }
public String getOriginalFederationShortName() {
return originalFederationShortName;
}
public void setOriginalFederationShortName(String originalFederationShortName) {
this.originalFederationShortName = originalFederationShortName;
}
} }
...@@ -120,6 +120,16 @@ public class DiscoveryLoginBean implements Serializable { ...@@ -120,6 +120,16 @@ public class DiscoveryLoginBean implements Serializable {
} }
} }
if (sessionManager.getOriginalFederationShortName() != null) {
FederationEntity f = federationBean.getFederationList().stream()
.filter(federation -> sessionManager.getOriginalFederationShortName().equals(federation.getShortName()))
.findFirst()
.orElse(null);
if (f != null) {
selectedFederation = f;
}
}
if (! initialized) { if (! initialized) {
federationList = federationBean.getFederationList(); federationList = federationBean.getFederationList();
if (federationList == null || federationList.size() == 0) { if (federationList == null || federationList.size() == 0) {
......
...@@ -221,6 +221,7 @@ public class SecurityFilter implements Filter { ...@@ -221,6 +221,7 @@ public class SecurityFilter implements Filter {
logger.debug("User from {} not logged in. Redirecting to welcome page", request.getRemoteAddr()); logger.debug("User from {} not logged in. Redirecting to welcome page", request.getRemoteAddr());
session.setOriginalIdpEntityId(request.getParameter("idp")); session.setOriginalIdpEntityId(request.getParameter("idp"));
session.setOriginalFederationShortName(request.getParameter("federation"));
session.setOriginalRequestPath(getFullURL(request)); session.setOriginalRequestPath(getFullURL(request));
request.getServletContext().getRequestDispatcher("/welcome/").forward(servletRequest, servletResponse); request.getServletContext().getRequestDispatcher("/welcome/").forward(servletRequest, servletResponse);
} }
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
<bw:inputText id="nameField" label="#{messages.name}" <bw:inputText id="nameField" label="#{messages.name}"
value="#{editFederationBean.entity.name}" required="true" /> value="#{editFederationBean.entity.name}" required="true" />
<bw:inputText id="shortNameField" label="#{messages.short_name}"
value="#{editFederationBean.entity.shortName}" />
<bw:inputText id="urlField" label="#{messages.url}" <bw:inputText id="urlField" label="#{messages.url}"
value="#{editFederationBean.entity.federationMetadataUrl}" /> value="#{editFederationBean.entity.federationMetadataUrl}" />
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
<h:outputText value="#{messages.name}:"/> <h:outputText value="#{messages.name}:"/>
<h:outputText value="#{showFederationBean.entity.name}"/> <h:outputText value="#{showFederationBean.entity.name}"/>
<h:outputText value="#{messages.short_name}:"/>
<h:outputText value="#{showFederationBean.entity.shortName}"/>
<h:outputText value="#{messages.entity_id}:"/> <h:outputText value="#{messages.entity_id}:"/>
<h:outputText value="#{showFederationBean.entity.entityId}"/> <h:outputText value="#{showFederationBean.entity.entityId}"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment