Skip to content

Commit f185046

Browse files
committed
Fix Javadoc
1 parent ca1878b commit f185046

9 files changed

Lines changed: 56 additions & 82 deletions

File tree

core/src/main/java/com/onelogin/saml2/model/AttributeConsumingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final String getServiceDescription() {
6262
}
6363

6464
/**
65-
* @return List<RequestedAttribute> the requested attributes
65+
* @return List the requested attributes
6666
*/
6767
public final List<RequestedAttribute> getRequestedAttributes() {
6868
return requestedAttributes;

core/src/main/java/com/onelogin/saml2/model/RequestedAttribute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class RequestedAttribute {
4646
* @param nameFormat
4747
* Boolean. RequestedAttribute NameFormat
4848
* @param attributeValues
49-
* List<String>. RequestedAttribute values
49+
* List. RequestedAttribute values
5050
*/
5151
public RequestedAttribute(String name, String friendlyName, Boolean isRequired, String nameFormat, List<String> attributeValues) {
5252
this.name = name;

core/src/main/java/com/onelogin/saml2/settings/IdPMetadataParser.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static Map<String, Object> parseXML(Document xmlDocument, String entityId
145145
* Get IdP Metadata Info from XML Document
146146
*
147147
* @param xmlDocument
148-
* XML document hat contains IdP metadata
148+
* XML document that contains IdP metadata
149149
* @param entityId
150150
* Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
151151
*
@@ -160,7 +160,7 @@ public static Map<String, Object> parseXML(Document xmlDocument, String entityId
160160
* Get IdP Metadata Info from XML Document
161161
*
162162
* @param xmlDocument
163-
* XML document hat contains IdP metadata
163+
* XML document that contains IdP metadata
164164
*
165165
* @return Mapped values with metadata info in Saml2Settings format
166166
* @throws XPathException
@@ -172,8 +172,8 @@ public static Map<String, Object> parseXML(Document xmlDocument) throws XPathExc
172172
/**
173173
* Get IdP Metadata Info from XML file
174174
*
175-
* @param xmlDocument
176-
* XML document hat contains IdP metadata
175+
* @param xmlFileName
176+
* Filename of the XML filename that contains IdP metadata
177177
* @param entityId
178178
* Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
179179
* @param desiredNameIdFormat
@@ -205,8 +205,8 @@ public static Map<String, Object> parseFileXML(String xmlFileName, String entity
205205
/**
206206
* Get IdP Metadata Info from XML file
207207
*
208-
* @param xmlDocument
209-
* XML document hat contains IdP metadata
208+
* @param xmlFileName
209+
* Filename of the XML filename that contains IdP metadata
210210
* @param entityId
211211
* Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
212212
*
@@ -220,8 +220,8 @@ public static Map<String, Object> parseFileXML(String xmlFileName, String entity
220220
/**
221221
* Get IdP Metadata Info from XML file
222222
*
223-
* @param xmlDocument
224-
* XML document hat contains IdP metadata
223+
* @param xmlFileName
224+
* Filename of the XML filename that contains IdP metadata
225225
*
226226
* @return Mapped values with metadata info in Saml2Settings format
227227
* @throws Exception
@@ -233,8 +233,8 @@ public static Map<String, Object> parseFileXML(String xmlFileName) throws Except
233233
/**
234234
* Get IdP Metadata Info from XML file
235235
*
236-
* @param xmlDocument
237-
* XML document hat contains IdP metadata
236+
* @param xmlURL
237+
* URL to the XML document that contains IdP metadata
238238
* @param entityId
239239
* Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
240240
* @param desiredNameIdFormat
@@ -255,8 +255,8 @@ public static Map<String, Object> parseRemoteXML(URL xmlURL, String entityId, St
255255
/**
256256
* Get IdP Metadata Info from XML file
257257
*
258-
* @param xmlDocument
259-
* XML document hat contains IdP metadata
258+
* @param xmlURL
259+
* URL to the XML document that contains IdP metadata
260260
* @param entityId
261261
* Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
262262
*
@@ -270,8 +270,8 @@ public static Map<String, Object> parseRemoteXML(URL xmlURL, String entityId) th
270270
/**
271271
* Get IdP Metadata Info from XML file
272272
*
273-
* @param xmlDocument
274-
* XML document hat contains IdP metadata
273+
* @param xmlURL
274+
* URL to the XML document that contains IdP metadata
275275
*
276276
* @return Mapped values with metadata info in Saml2Settings format
277277
* @throws Exception

core/src/main/java/com/onelogin/saml2/settings/SettingsBuilder.java

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,22 @@ public class SettingsBuilder {
128128
* @throws IOException
129129
* @throws Error
130130
*/
131-
public SettingsBuilder fromFile(String propFileName) throws Error {
131+
public SettingsBuilder fromFile(String propFileName) throws Error, IOException {
132132
return fromFile(propFileName, null);
133133
}
134134

135135
/**
136136
* Load settings from the file
137137
*
138138
* @param propFileName OneLogin_Saml2_Settings
139-
* @param ks KeyStore which have the Private/Public keys
140-
* @param alias Alias in the KeyStore to be used as key
141-
* @param password Password for accessing KeyStore
139+
* @param keyStoreSetting KeyStore which have the Private/Public keys
142140
*
143141
* @return the SettingsBuilder object with the settings loaded from the file
144142
*
145143
* @throws IOException
146144
* @throws Error
147145
*/
148-
public SettingsBuilder fromFile(String propFileName, KeyStoreSettings keyStoreSetting) throws Error {
146+
public SettingsBuilder fromFile(String propFileName, KeyStoreSettings keyStoreSetting) throws Error, IOException {
149147

150148
ClassLoader classLoader = getClass().getClassLoader();
151149
try (InputStream inputStream = classLoader.getResourceAsStream(propFileName)) {
@@ -188,7 +186,7 @@ public SettingsBuilder fromProperties(Properties prop) {
188186
/**
189187
* Loads the settings from mapped values.
190188
*
191-
* @param values Mapped values.
189+
* @param samlData Mapped values.
192190
*
193191
* @return the SettingsBuilder object with the settings loaded from the prop
194192
* object
@@ -740,37 +738,10 @@ protected PrivateKey loadPrivateKeyFromProp(String propertyKey) {
740738
}
741739

742740
/**
743-
* Loads a property of the type PrivateKey from file
744-
*
745-
* @param filename the file name of the file that contains the PrivateKey
741+
* Parses properties
746742
*
747-
* @return the PrivateKey object
743+
* @param properties the Properties object to be parsed
748744
*/
749-
/*
750-
protected PrivateKey loadPrivateKeyFromFile(String filename) {
751-
String keyString = null;
752-
753-
try {
754-
keyString = Util.getFileAsString(filename.trim());
755-
} catch (URISyntaxException e) {
756-
LOGGER.error("Error loading privatekey from file.", e);
757-
return null;
758-
} catch (IOException e) {
759-
LOGGER.error("Error loading privatekey from file.", e);
760-
return null;
761-
}
762-
763-
try {
764-
return Util.loadPrivateKey(keyString);
765-
} catch (GeneralSecurityException e) {
766-
LOGGER.error("Error loading privatekey from file.", e);
767-
return null;
768-
} catch (IOException e) {
769-
LOGGER.debug("Error loading privatekey from file.", e);
770-
return null;
771-
}
772-
}
773-
*/
774745
private void parseProperties(Properties properties) {
775746
if (properties != null) {
776747
for (String propertyKey : properties.stringPropertyNames()) {
@@ -779,12 +750,22 @@ private void parseProperties(Properties properties) {
779750
}
780751
}
781752

753+
/**
754+
* Parses the KeyStore data
755+
*
756+
* @param setting the KeyStoreSettings object to be parsed
757+
*/
782758
private void parseKeyStore(KeyStoreSettings setting) {
783759
this.samlData.put(KEYSTORE_KEY, setting.getKeyStore());
784760
this.samlData.put(KEYSTORE_ALIAS, setting.getSpAlias());
785761
this.samlData.put(KEYSTORE_PASSWORD, setting.getStorePass());
786762
}
787763

764+
/**
765+
* Aux method that verifies if an Object is an string
766+
*
767+
* @param propValue the Object to be verified
768+
*/
788769
private boolean isString(Object propValue) {
789770
return propValue instanceof String && StringUtils.isNotBlank((String) propValue);
790771
}

core/src/main/java/com/onelogin/saml2/util/Util.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ private Util() {
123123

124124
/**
125125
* Method which uses the recommended way ( https://docs.oracle.com/javase/tutorial/jaxp/properties/error.html )
126-
* of checking if JAXP >= 1.5 options are supported. Needed if the project which uses this library also has
127-
* Xerces in it's classpath.
126+
* of checking if JAXP is equal or greater than 1.5 options are supported. Needed if the project which uses
127+
* this library also has Xerces in it's classpath.
128128
*
129129
* If for whatever reason this method cannot determine if JAXP 1.5 properties are supported it will indicate the
130130
* options are supported. This way we don't accidentally disable configuration options.
@@ -339,8 +339,8 @@ public static Document convertStringToDocument(String xmlStr) throws ParserConfi
339339
/**
340340
* Parse an XML from input source to a Document object
341341
*
342-
* @param xmlStr
343-
* The XML string which should be converted
342+
* @param inputSource
343+
* The InputSource with the XML string which should be converted
344344
*
345345
* @return the Document object
346346
*
@@ -910,7 +910,7 @@ public static boolean validateSign(final Document doc, final X509Certificate cer
910910
* Validate the signature pointed to by the xpath
911911
*
912912
* @param doc The document we should validate
913-
* @param certs The public certificates
913+
* @param certList The public certificates
914914
* @param fingerprint The fingerprint of the public certificate
915915
* @param alg The signature algorithm method
916916
* @param xpath the xpath of the ds:Signture node to validate
@@ -1029,12 +1029,6 @@ public static Boolean validateSignNode(Node signNode, X509Certificate cert, Stri
10291029
/**
10301030
* Whitelist the XMLSignature algorithm
10311031
*
1032-
* @param signNode
1033-
* The document we should validate
1034-
* @param cert
1035-
* The public certificate
1036-
* @param fingerprint
1037-
* The fingerprint of the public certificate
10381032
* @param alg
10391033
* The signature algorithm method
10401034
*

core/src/test/java/com/onelogin/saml2/test/authn/AuthnRequestTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void testGetEncodedAuthnRequestOnlySettings() throws Exception {
105105
*
106106
* @throws Exception
107107
*
108-
* @see com.onelogin.saml2.authn.getAuthnRequestXml
108+
* @see com.onelogin.saml2.authn.AuthnRequest#getAuthnRequestXml
109109
*/
110110
@Test
111111
public void testGetAuthnRequestXml() throws Exception {
@@ -313,7 +313,7 @@ public void testSubject() throws Exception {
313313
*
314314
* @throws Exception
315315
*
316-
* @see com.onelogin.saml2.authn.getId
316+
* @see com.onelogin.saml2.authn.AuthnRequest.getId
317317
*/
318318
@Test
319319
public void testGetId() throws Exception

core/src/test/java/com/onelogin/saml2/test/settings/Saml2SettingsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class Saml2SettingsTest {
3131

3232
/**
33-
* Tests the isStrict & setStrict methods of the Saml2Settings
33+
* Tests the isStrict and setStrict methods of the Saml2Settings
3434
*
3535
* @see com.onelogin.saml2.settings.Saml2Settings#isStrict
3636
* @see com.onelogin.saml2.settings.Saml2Settings#setStrict
@@ -47,7 +47,7 @@ public void testIsStrict() {
4747
}
4848

4949
/**
50-
* Tests the isDebugActive & setDebug methods of the Saml2Settings
50+
* Tests the isDebugActive and setDebug methods of the Saml2Settings
5151
*
5252
* @see com.onelogin.saml2.settings.Saml2Settings#isDebugActive
5353
* @see com.onelogin.saml2.settings.Saml2Settings#setDebug

core/src/test/java/com/onelogin/saml2/test/settings/SettingBuilderTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private KeyStoreSettings getKeyStoreSettings() throws KeyStoreException, NoSuchA
9999
* @throws KeyStoreException
100100
* @throws NoSuchAlgorithmException
101101
*
102-
* @see {@link com.onelogin.saml2.settings.SettingsBuilder#fromFile(String, java.security.KeyStore, String, String)}
102+
* @see com.onelogin.saml2.settings.SettingsBuilder#fromFile
103103
*/
104104
@Test
105105
public void testLoadFromFileAndKeyStore() throws IOException, CertificateException, URISyntaxException, SettingsException, Error, KeyStoreException, NoSuchAlgorithmException {
@@ -664,6 +664,8 @@ public void testFromProperties() throws IOException, Error, CertificateException
664664
* Tests SettingsBuilder constructor
665665
* Case: settings from values
666666
*
667+
* @throws IOException
668+
*
667669
* @see com.onelogin.saml2.settings.SettingsBuilder
668670
*/
669671
@Test
@@ -819,6 +821,8 @@ public void testLoadFromValues() throws Exception {
819821
* Tests SettingsBuilder constructor
820822
* Case: settings from values
821823
*
824+
* @throws IOException
825+
*
822826
* @see com.onelogin.saml2.settings.SettingsBuilder
823827
*/
824828
@Test

toolkit/src/main/java/com/onelogin/saml2/Auth.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ public Auth(String filename) throws IOException, SettingsException, Error {
179179
* Initializes the SP SAML instance.
180180
*
181181
* @param filename String Filename with the settings
182-
* @param ks KeyStore which have the Private/Public keys
183-
* @param alias Alias in the KeyStore to be used as key
184-
* @param password Password for accessing KeyStore
182+
* @param keyStoreSetting KeyStoreSettings is a KeyStore which have the Private/Public keys
183+
*
185184
* @throws IOException
186185
* @throws SettingsException
187186
* @throws Error
@@ -208,9 +207,7 @@ public Auth(HttpServletRequest request, HttpServletResponse response) throws IOE
208207
/**
209208
* Initializes the SP SAML instance.
210209
*
211-
* @param ks KeyStore which have the Private/Public keys
212-
* @param alias Alias in the KeyStore to be used as key
213-
* @param password Password for accessing KeyStore
210+
* @param keyStoreSetting KeyStoreSettings is a KeyStore which have the Private/Public keys
214211
* @param request HttpServletRequest object to be processed
215212
* @param response HttpServletResponse object to be used
216213
*
@@ -243,12 +240,10 @@ public Auth(String filename, HttpServletRequest request, HttpServletResponse res
243240
/**
244241
* Initializes the SP SAML instance.
245242
*
246-
* @param filename String Filename with the settings
247-
* @param ks KeyStore which have the Private/Public keys
248-
* @param alias Alias in the KeyStore to be used as key
249-
* @param password Password for accessing KeyStore
250-
* @param request HttpServletRequest object to be processed
251-
* @param response HttpServletResponse object to be used
243+
* @param filename String Filename with the settings
244+
* @param keyStoreSetting KeyStoreSettings is a KeyStore which have the Private/Public keys
245+
* @param request HttpServletRequest object to be processed
246+
* @param response HttpServletResponse object to be used
252247
*
253248
* @throws SettingsException
254249
* @throws IOException
@@ -1019,10 +1014,10 @@ public String buildResponseSignature(String samlResponse, String relayState, Str
10191014
}
10201015

10211016
/**
1022-
* Generates the Signature for a SAML Response
1017+
* Generates the Signature for a SAML Message
10231018
*
1024-
* @param samlResponse
1025-
* The SAML Response
1019+
* @param samlMessage
1020+
* The SAML Message
10261021
* @param relayState
10271022
* The RelayState
10281023
* @param signAlgorithm

0 commit comments

Comments
 (0)