Skip to content

Commit c519270

Browse files
authored
Merge pull request #27 from securenative/dev
Fix context factory names
2 parents d8c62a0 + bd93c6b commit c519270

File tree

8 files changed

+28
-39
lines changed

8 files changed

+28
-39
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [macos-latest, ubuntu-latest]
15+
os: [ubuntu-latest]
1616
steps:
1717
- name: Notify slack success
1818
if: success()

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [macos-latest, ubuntu-latest]
15+
os: [ubuntu-latest]
1616
steps:
1717
- name: Notify slack success
1818
if: success()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ When using Maven, add the following dependency to your `pom.xml` file:
3333
```xml
3434
<dependency>
3535
<groupId>com.securenative.java</groupId>
36-
<artifactId>sdk-base</artifactId>
36+
<artifactId>securenative-java</artifactId>
3737
<version>LATEST</version>
3838
</dependency>
3939
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>com.securenative.java</groupId>
77
<artifactId>securenative-java</artifactId>
88
<packaging>jar</packaging>
9-
<version>0.4.5</version>
9+
<version>0.4.6</version>
1010
<url>https://github.com/securenative/securenative-java</url>
1111

1212
<name>${project.groupId}:${project.artifactId}:${project.version}</name>

pom.xml.asc

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/main/java/com/securenative/context/SecureNativeContextBuilder.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@ private SecureNativeContextBuilder() {
1313
this.context = new SecureNativeContext();
1414
}
1515

16-
public SecureNativeContextBuilder clientToken(String clientToken) {
16+
public SecureNativeContextBuilder withClientToken(String clientToken) {
1717
this.context.setClientToken(clientToken);
1818
return this;
1919
}
2020

21-
public SecureNativeContextBuilder ip(String ip) {
21+
public SecureNativeContextBuilder withIp(String ip) {
2222
this.context.setIp(ip);
2323
return this;
2424
}
2525

26-
public SecureNativeContextBuilder remoteIp(String remoteIp) {
26+
public SecureNativeContextBuilder withRemoteIp(String remoteIp) {
2727
this.context.setRemoteIp(remoteIp);
2828
return this;
2929
}
3030

31-
public SecureNativeContextBuilder headers(Map<String, String> headers) {
31+
public SecureNativeContextBuilder withHeaders(Map<String, String> headers) {
3232
this.context.setHeaders(headers);
3333
return this;
3434
}
3535

36-
public SecureNativeContextBuilder url(String url) {
36+
public SecureNativeContextBuilder withUrl(String url) {
3737
this.context.setUrl(url);
3838
return this;
3939
}
4040

41-
public SecureNativeContextBuilder method(String method) {
41+
public SecureNativeContextBuilder withMethod(String method) {
4242
this.context.setMethod(method);
4343
return this;
4444
}
4545

46-
public SecureNativeContextBuilder body(String body) {
46+
public SecureNativeContextBuilder withBody(String body) {
4747
this.context.setBody(body);
4848
return this;
4949
}
@@ -61,13 +61,13 @@ public static SecureNativeContextBuilder fromHttpServletRequest(HttpServletReque
6161
}
6262

6363
return new SecureNativeContextBuilder()
64-
.url(request.getRequestURI())
65-
.method(request.getMethod())
66-
.headers(headers)
67-
.clientToken(clientToken)
68-
.ip(RequestUtils.getClientIpFromRequest(request, headers))
69-
.remoteIp(RequestUtils.getRemoteIpFromRequest(request))
70-
.body(null);
64+
.withUrl(request.getRequestURI())
65+
.withMethod(request.getMethod())
66+
.withHeaders(headers)
67+
.withClientToken(clientToken)
68+
.withIp(RequestUtils.getClientIpFromRequest(request, headers))
69+
.withRemoteIp(RequestUtils.getRemoteIpFromRequest(request))
70+
.withBody(null);
7171
}
7272

7373
public SecureNativeContext build(){

src/test/java/com/securenative/ApiManagerImplTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public class ApiManagerImplTest extends HTTPServerMock {
3535
public ApiManagerImplTest() throws SecureNativeInvalidOptionsException {
3636
// init default event for tests
3737
SecureNativeContext context = SecureNative.contextBuilder()
38-
.ip("127.0.0.1")
39-
.clientToken("SECURED_CLIENT_TOKEN")
40-
.headers(Maps.defaultBuilder()
38+
.withIp("127.0.0.1")
39+
.withClientToken("SECURED_CLIENT_TOKEN")
40+
.withHeaders(Maps.defaultBuilder()
4141
.put("user-agent", "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405")
4242
.build())
4343
.build();

src/test/java/com/securenative/context/SecureNativeContextBuilderTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ public void createDefaultContextBuilderTest() {
8383
public void createCustomContextWithContextBuilderTest() {
8484
SecureNativeContext context = SecureNativeContextBuilder
8585
.defaultContextBuilder()
86-
.url("/some-url")
87-
.clientToken("SECRET_TOKEN")
88-
.ip("10.0.0.0")
89-
.body("{ \"name\": \"YOUR_NAME\" }")
90-
.method("Get")
91-
.remoteIp("10.0.0.1")
92-
.headers(Maps.defaultBuilder()
86+
.withUrl("/some-url")
87+
.withClientToken("SECRET_TOKEN")
88+
.withIp("10.0.0.0")
89+
.withBody("{ \"name\": \"YOUR_NAME\" }")
90+
.withMethod("Get")
91+
.withRemoteIp("10.0.0.1")
92+
.withHeaders(Maps.defaultBuilder()
9393
.put("header1", "value1")
9494
.build())
9595
.build();

0 commit comments

Comments
 (0)