diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java')
4 files changed, 167 insertions, 41 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java index 56f31723c..67fbd50f8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java @@ -18,7 +18,7 @@ public class ExternalAttributeRequestRequiredException extends Exception { } /** - * Gets the ap. + * Gets the ap that caused the exception. * * @return the ap */ diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKRequest.java index e95cfabe2..9ea33c8ef 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKRequest.java @@ -9,57 +9,95 @@ import eu.stork.peps.auth.commons.STORKAttrQueryRequest; import eu.stork.peps.auth.commons.STORKAuthnRequest; /** - * Implements MOA request and stores StorkAuthn/Attr-Request related data + * Implements MOA request and stores StorkAuthn/Attr-Request related data. * * @author bsuzic */ - public class MOASTORKRequest implements IRequest, Serializable { + + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 4581953368724501376L; + + /** The request id. */ private String requestID; + + /** The target. */ private String target = null; + + /** The module. */ String module = null; + + /** The action. */ String action = null; + + /** The stork authn request. */ private STORKAuthnRequest storkAuthnRequest; + + /** The stork attr query request. */ private STORKAttrQueryRequest storkAttrQueryRequest; - private boolean isAttrRequest = false; - private boolean isAuthnRequest = false; + /** + * Sets the sTORK authn request. + * + * @param request the new sTORK authn request + */ public void setSTORKAuthnRequest(STORKAuthnRequest request) { this.storkAuthnRequest = request; - if (request != null) { - isAuthnRequest = true; - } } + /** + * Sets the sTORK attr request. + * + * @param request the new sTORK attr request + */ public void setSTORKAttrRequest(STORKAttrQueryRequest request) { this.storkAttrQueryRequest = request; - if (request != null) { - isAttrRequest = true; - } } + /** + * Checks if the container holds an AttrQueryRequest + * + * @return true, if is attr request + */ public boolean isAttrRequest() { - return this.isAttrRequest; + return null != storkAttrQueryRequest; } + /** + * Checks if the container holds an AuthnRequest + * + * @return true, if is authn request + */ public boolean isAuthnRequest() { - return this.isAuthnRequest; + return null != storkAuthnRequest; } + /** + * Gets the stork authn request. + * + * @return the stork authn request + */ public STORKAuthnRequest getStorkAuthnRequest() { return this.storkAuthnRequest; } + /** + * Gets the stork attr query request. + * + * @return the stork attr query request + */ public STORKAttrQueryRequest getStorkAttrQueryRequest() { return this.storkAttrQueryRequest; } - public String getOAURL() { // TODO CHECK IT - if (isAuthnRequest) + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#getOAURL() + */ + public String getOAURL() { + if (isAuthnRequest()) return storkAuthnRequest.getAssertionConsumerServiceURL(); - else if (isAttrRequest) + else if (isAttrRequest()) return storkAttrQueryRequest.getAssertionConsumerServiceURL(); else { Logger.error("There is no authentication or attribute request contained in MOASTORKRequest."); @@ -67,46 +105,81 @@ public class MOASTORKRequest implements IRequest, Serializable { } } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#isPassiv() + */ public boolean isPassiv() { return false; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#forceAuth() + */ public boolean forceAuth() { return false; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#isSSOSupported() + */ public boolean isSSOSupported() { return false; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule() + */ public String requestedModule() { return this.module; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedAction() + */ public String requestedAction() { return action; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#setModule(java.lang.String) + */ public void setModule(String module) { this.module = module; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#setAction(java.lang.String) + */ public void setAction(String action) { this.action = action; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#getTarget() + */ public String getTarget() { return this.target; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#setRequestID(java.lang.String) + */ public void setRequestID(String id) { this.requestID = id; } + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.moduls.IRequest#getRequestID() + */ public String getRequestID() { return this.requestID; } + /** + * Gets the personal attribute list. + * + * @return the personal attribute list + */ public IPersonalAttributeList getPersonalAttributeList() { if(isAttrRequest()) return this.storkAttrQueryRequest.getPersonalAttributeList(); @@ -114,6 +187,11 @@ public class MOASTORKRequest implements IRequest, Serializable { return this.storkAuthnRequest.getPersonalAttributeList(); } + /** + * Gets the sp country. + * + * @return the sp country + */ public String getSpCountry() { if(isAttrRequest()) return this.storkAttrQueryRequest.getSpCountry(); @@ -121,6 +199,11 @@ public class MOASTORKRequest implements IRequest, Serializable { return this.storkAuthnRequest.getSpCountry(); } + /** + * Gets the assertion consumer service url. + * + * @return the assertion consumer service url + */ public String getAssertionConsumerServiceURL() { if(isAttrRequest()) return this.storkAttrQueryRequest.getAssertionConsumerServiceURL(); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKResponse.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKResponse.java index 36f5a80b4..4e0f57779 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKResponse.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKResponse.java @@ -8,68 +8,110 @@ import eu.stork.peps.auth.commons.STORKAttrQueryResponse; import eu.stork.peps.auth.commons.STORKAuthnResponse; /** - * Implements MOA request and stores StorkAuthn/Attr-Request related data + * Implements MOA request and stores StorkAuthn/Attr-Request related data. * * @author bsuzic */ - public class MOASTORKResponse implements Serializable { + + /** The Constant serialVersionUID. */ private static final long serialVersionUID = -5798803155055518747L; - private STORKAuthnResponse storkAuthnRequest; - private STORKAttrQueryResponse storkAttrQueryRequest; - private boolean isAttrRequest = false; - private boolean isAuthnRequest = false; - + + /** The stork authn request. */ + private STORKAuthnResponse storkAuthnResponse; + + /** The stork attr query request. */ + private STORKAttrQueryResponse storkAttrQueryResponse; + + /** + * Sets the sTORK authn response. + * + * @param request the new sTORK authn response + */ public void setSTORKAuthnResponse(STORKAuthnResponse request) { - this.storkAuthnRequest = request; - if (request != null) { - isAuthnRequest = true; - } + this.storkAuthnResponse = request; } + /** + * Sets the sTORK attr response. + * + * @param request the new sTORK attr response + */ public void setSTORKAttrResponse(STORKAttrQueryResponse request) { - this.storkAttrQueryRequest = request; - if (request != null) { - isAttrRequest = true; - } + this.storkAttrQueryResponse = request; } + /** + * Checks if the container holds an AttrQuery + * + * @return true, if is attr response + */ public boolean isAttrResponse() { - return this.isAttrRequest; + return null != storkAttrQueryResponse; } + /** + * Checks if the container holds an AuthnRequest + * + * @return true, if is authn response + */ public boolean isAuthnResponse() { - return this.isAuthnRequest; + return null != storkAuthnResponse; } + /** + * Gets the AuthnResponse. + * + * @return the stork authn response + */ public STORKAuthnResponse getStorkAuthnResponse() { - return this.storkAuthnRequest; + return this.storkAuthnResponse; } + /** + * Gets the AttrQueryResponse. + * + * @return the stork attr query response + */ public STORKAttrQueryResponse getStorkAttrQueryResponse() { - return this.storkAttrQueryRequest; + return this.storkAttrQueryResponse; } + /** + * Gets the personal attribute list. + * + * @return the personal attribute list + */ public IPersonalAttributeList getPersonalAttributeList() { if(isAttrResponse()) - return this.storkAttrQueryRequest.getPersonalAttributeList(); + return this.storkAttrQueryResponse.getPersonalAttributeList(); else - return this.storkAuthnRequest.getPersonalAttributeList(); + return this.storkAuthnResponse.getPersonalAttributeList(); } + /** + * Sets the personal attribute list. + * + * @param populateAttributes the new personal attribute list + */ public void setPersonalAttributeList(PersonalAttributeList populateAttributes) { if(isAttrResponse()) - this.storkAttrQueryRequest.setPersonalAttributeList(populateAttributes); + this.storkAttrQueryResponse.setPersonalAttributeList(populateAttributes); else - this.storkAuthnRequest.setPersonalAttributeList(populateAttributes); + this.storkAuthnResponse.setPersonalAttributeList(populateAttributes); } + /** + * Sets the country. + * + * @param spCountry the new country + */ public void setCountry(String spCountry) { if(isAttrResponse()) - this.storkAttrQueryRequest.setCountry(spCountry); + this.storkAttrQueryResponse.setCountry(spCountry); else - this.storkAuthnRequest.setCountry(spCountry); + this.storkAuthnResponse.setCountry(spCountry); } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java index 2b946b167..73b8e01b9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java @@ -38,6 +38,7 @@ public class StorkAttributeRequestProvider implements AttributeProvider { /** The attributes. */ private String attributes; + /** The sp country code. */ private String spCountryCode; /** |