Skip to content

Commit e0f5e34

Browse files
committed
Merge branch 'master' into RESTCOMM-2064
2 parents deed34d + 7ba2303 commit e0f5e34

File tree

54 files changed

+1674
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1674
-46
lines changed

release/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<property name="restcomm-media.distro.zip.path" value="${checkout.dir}/${restcomm-media.download.distro.file}"/>
3434

3535
<!-- <property name="restcomm-olympus.download.url" value="https://mobicents.ci.cloudbees.com/job/Olympus/${olympus.build}/artifact/target/olympus.war"/> -->
36-
<property name="restcomm-olympus.download.url" value="https://app.box.com/shared/static/0rf2w3q7r0g2b4p4rtptc24wauxegfsf.war"/>
36+
<property name="restcomm-olympus.download.url" value="https://app.box.com/shared/static/p78uyxuuzg4fa8kl68ljiyzjkl9ei3r8.war"/>
3737
<property name="restcomm-olympus.path" value="${configuration.directory}/olympus.war"/>
3838

3939
<!-- Determine RVD retrieval URL

restcomm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<groupId>org.restcomm</groupId>
1212
<artifactId>restcomm-connect</artifactId>
13-
<version>8.3.2-SNAPSHOT</version>
13+
<version>9.0.0-SNAPSHOT</version>
1414
<packaging>pom</packaging>
1515
<name>RestComm-Connect</name>
1616
<description>A unified communications platform for web developers.</description>

restcomm/restcomm.application/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.restcomm</groupId>
66
<artifactId>restcomm-connect</artifactId>
7-
<version>8.3.2-SNAPSHOT</version>
7+
<version>9.0.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>restcomm-connect.application</artifactId>

restcomm/restcomm.asr/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.restcomm</groupId>
55
<artifactId>restcomm-connect</artifactId>
6-
<version>8.3.2-SNAPSHOT</version>
6+
<version>9.0.0-SNAPSHOT</version>
77
</parent>
88

99
<artifactId>restcomm-connect.asr</artifactId>

restcomm/restcomm.commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.restcomm</groupId>
77
<artifactId>restcomm-connect</artifactId>
8-
<version>8.3.2-SNAPSHOT</version>
8+
<version>9.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>restcomm-connect.commons</artifactId>

restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/DigestAuthentication.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,12 @@ public static String HA1(String username, String realm, String password){
144144
ha1 = DigestAuthentication.H(username+":"+realm+":"+password, algorithm);
145145
return ha1;
146146
}
147+
148+
149+
//USed for unit testing
150+
public static String HA1(String username, String realm, String password, String algorithm){
151+
String ha1 = "";
152+
ha1 = DigestAuthentication.H(username+":"+realm+":"+password, algorithm);
153+
return ha1;
154+
}
147155
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* TeleStax, Open Source Cloud Communications
3+
* Copyright 2011-2018, Telestax Inc and individual contributors
4+
* by the @authors tag.
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation; either version 3 of
9+
* the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>
18+
*/
19+
20+
package org.restcomm.connect.commons;
21+
22+
import org.junit.Test;
23+
import org.restcomm.connect.commons.dao.Sid;
24+
import org.restcomm.connect.commons.util.DigestAuthentication;
25+
26+
import java.util.HashMap;
27+
import java.util.Map;
28+
29+
import static org.junit.Assert.assertEquals;
30+
import static org.junit.Assert.assertTrue;
31+
32+
public class DigestAuthenticationTest {
33+
34+
private String client = "alice0000000";
35+
private String domain = "org0000000.restcomm.com";
36+
private String password = "1234";
37+
private String proxyAuthHeader = "Digest username=\"alice0000000\",realm=\"org0000000.restcomm.com\",cnonce=\"6b8b4567\",nc=00000001,qop=auth,uri=\"sip:172.31.45.30:5080\",nonce=\"61343361383534392d633237372d343\",response=\"bc322276e42a123c53c2ed6f53d5e7c7\",algorithm=MD5";
38+
39+
@Test
40+
public void testAuth(){
41+
String hashedPass = DigestAuthentication.HA1(client, domain, password, "MD5");
42+
43+
assertEquals("9b11a2924d0881aca84f9db97f834d99", hashedPass);
44+
45+
assertTrue(permitted(proxyAuthHeader, "INVITE", hashedPass));
46+
47+
}
48+
49+
static boolean permitted(final String authorization, final String method, String clientPassword) {
50+
final Map<String, String> map = authHeaderToMap(authorization);
51+
String user = map.get("username");
52+
final String algorithm = map.get("algorithm");
53+
final String realm = map.get("realm");
54+
final String uri = map.get("uri");
55+
final String nonce = map.get("nonce");
56+
final String nc = map.get("nc");
57+
final String cnonce = map.get("cnonce");
58+
final String qop = map.get("qop");
59+
final String response = map.get("response");
60+
final String password2 = clientPassword;
61+
final String result = DigestAuthentication.response(algorithm, user, realm, "", password2, nonce, nc, cnonce,
62+
method, uri, null, qop);
63+
return result.equals(response);
64+
}
65+
66+
private static Map<String, String> authHeaderToMap(final String header) {
67+
final Map<String, String> map = new HashMap<String, String>();
68+
final int endOfScheme = header.indexOf(" ");
69+
map.put("scheme", header.substring(0, endOfScheme).trim());
70+
final String[] tokens = header.substring(endOfScheme + 1).split(",");
71+
for (final String token : tokens) {
72+
final String[] values = token.trim().split("=",2); //Issue #935, split only for first occurrence of "="
73+
map.put(values[0].toLowerCase(), values[1].replace("\"", ""));
74+
}
75+
76+
return map;
77+
}
78+
79+
}

restcomm/restcomm.core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.restcomm</groupId>
66
<artifactId>restcomm-connect</artifactId>
7-
<version>8.3.2-SNAPSHOT</version>
7+
<version>9.0.0-SNAPSHOT</version>
88
</parent>
99
<artifactId>restcomm-connect.core</artifactId>
1010
<name>restcomm-connect.core</name>

restcomm/restcomm.dao/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.restcomm</groupId>
88
<artifactId>restcomm-connect</artifactId>
9-
<version>8.3.2-SNAPSHOT</version>
9+
<version>9.0.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>restcomm-connect.dao</artifactId>

restcomm/restcomm.dns.api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.restcomm</groupId>
55
<artifactId>restcomm-connect</artifactId>
6-
<version>8.3.2-SNAPSHOT</version>
6+
<version>9.0.0-SNAPSHOT</version>
77
</parent>
88
<artifactId>restcomm-connect.dns.api</artifactId>
99

0 commit comments

Comments
 (0)