-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LPD-33798 Remove unnecessary private variables
- Loading branch information
Showing
1 changed file
with
14 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ | |
|
||
package com.liferay.portal.security.sso.openid.connect.internal; | ||
|
||
import com.liferay.petra.function.UnsafeConsumer; | ||
import com.liferay.portal.kernel.json.JSONObject; | ||
import com.liferay.portal.kernel.json.JSONUtil; | ||
import com.liferay.portal.test.rule.LiferayUnitTestRule; | ||
|
||
|
@@ -23,10 +21,6 @@ | |
|
||
import org.mockito.Mockito; | ||
|
||
import org.springframework.mock.web.MockHttpServletRequest; | ||
import org.springframework.mock.web.MockHttpServletResponse; | ||
import org.springframework.mock.web.MockHttpSession; | ||
|
||
/** | ||
* @author Tamas Biro | ||
*/ | ||
|
@@ -41,42 +35,30 @@ public class OpenIdConnectAuthenticationHandlerImplTest { | |
public void setUp() { | ||
_openIdConnectAuthenticationHandlerImpl = | ||
new OpenIdConnectAuthenticationHandlerImpl(); | ||
_mockHttpServletRequest = new MockHttpServletRequest(); | ||
_mockHttpServletResponse = new MockHttpServletResponse(); | ||
_mockHttpSession = new MockHttpSession(); | ||
_userIdUnsafeConsumer = new UnsafeConsumer<Long, Exception>() { | ||
|
||
@Override | ||
public void accept(Long aLong) { | ||
} | ||
|
||
}; | ||
} | ||
|
||
@Test | ||
public void testWhenEmailIsInJWTClaimSet() throws Exception { | ||
_jsonObject = JSONUtil.put( | ||
"email", "[email protected]" | ||
).put( | ||
"name", "test_account" | ||
).put( | ||
"sub", "subject" | ||
); | ||
|
||
Map<String, Object> claims = _processClaimSet(_jsonObject.toString()); | ||
Map<String, Object> claims = _processClaimSet( | ||
JSONUtil.put( | ||
"email", "[email protected]" | ||
).put( | ||
"name", "test_account" | ||
).put( | ||
"sub", "subject" | ||
).toString()); | ||
|
||
Assert.assertEquals("[email protected]", claims.get("email")); | ||
} | ||
|
||
@Test | ||
public void testWhenEmailIsNotInJWTClaimSet() throws Exception { | ||
_jsonObject = JSONUtil.put( | ||
"name", "test_account" | ||
).put( | ||
"sub", "subject" | ||
); | ||
|
||
Map<String, Object> claims = _processClaimSet(_jsonObject.toString()); | ||
Map<String, Object> claims = _processClaimSet( | ||
JSONUtil.put( | ||
"name", "test_account" | ||
).put( | ||
"sub", "subject" | ||
).toString()); | ||
|
||
Assert.assertNull(claims.get("email")); | ||
} | ||
|
@@ -96,12 +78,7 @@ private Map<String, Object> _processClaimSet(String claimSetJSON) | |
mockJWT); | ||
} | ||
|
||
private JSONObject _jsonObject; | ||
private MockHttpServletRequest _mockHttpServletRequest; | ||
private MockHttpServletResponse _mockHttpServletResponse; | ||
private MockHttpSession _mockHttpSession; | ||
private OpenIdConnectAuthenticationHandlerImpl | ||
_openIdConnectAuthenticationHandlerImpl; | ||
private UnsafeConsumer<Long, Exception> _userIdUnsafeConsumer; | ||
|
||
} |