-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
docs: no docs (swagger updated) #2361
- Loading branch information
Showing
6 changed files
with
119 additions
and
14 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
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
77 changes: 77 additions & 0 deletions
77
...src/test/java/io/jans/as/server/authorize/ws/rs/AuthorizeRestWebServiceValidatorTest.java
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package io.jans.as.server.authorize.ws.rs; | ||
|
||
import io.jans.as.common.model.registration.Client; | ||
import io.jans.as.common.model.session.SessionId; | ||
import io.jans.as.model.configuration.AppConfiguration; | ||
import io.jans.as.model.error.ErrorResponseFactory; | ||
import io.jans.as.server.security.Identity; | ||
import io.jans.as.server.service.ClientService; | ||
import io.jans.as.server.service.DeviceAuthorizationService; | ||
import io.jans.as.server.service.RedirectionUriService; | ||
import io.jans.as.server.service.SessionIdService; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.testng.MockitoTestNGListener; | ||
import org.slf4j.Logger; | ||
import org.testng.annotations.Listeners; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.mockito.Mockito.when; | ||
import static org.testng.Assert.assertFalse; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
/** | ||
* @author Yuriy Z | ||
*/ | ||
@Listeners(MockitoTestNGListener.class) | ||
public class AuthorizeRestWebServiceValidatorTest { | ||
|
||
@InjectMocks | ||
private AuthorizeRestWebServiceValidator authorizeRestWebServiceValidator; | ||
|
||
@Mock | ||
private Logger log; | ||
|
||
@Mock | ||
private ErrorResponseFactory errorResponseFactory; | ||
|
||
@Mock | ||
private ClientService clientService; | ||
|
||
@Mock | ||
private RedirectionUriService redirectionUriService; | ||
|
||
@Mock | ||
private DeviceAuthorizationService deviceAuthorizationService; | ||
|
||
@Mock | ||
private AppConfiguration appConfiguration; | ||
|
||
@Mock | ||
private SessionIdService sessionIdService; | ||
|
||
@Mock | ||
private Identity identity; | ||
|
||
@Test | ||
public void isAuthnMaxAgeValid_whenMaxAgeIsZero_shouldReturnTrue() { | ||
assertTrue(authorizeRestWebServiceValidator.isAuthnMaxAgeValid(0, new SessionId(), new Client())); | ||
} | ||
|
||
@Test | ||
public void isAuthnMaxAgeValid_whenMaxAgeIsZeroAndDisableAuthnForMaxAgeZeroIsFalse_shouldReturnTrue() { | ||
when(appConfiguration.getDisableAuthnForMaxAgeZero()).thenReturn(false); | ||
assertTrue(authorizeRestWebServiceValidator.isAuthnMaxAgeValid(0, new SessionId(), new Client())); | ||
} | ||
|
||
@Test | ||
public void isAuthnMaxAgeValid_whenMaxAgeIsZeroAndDisableAuthnForMaxAgeZeroIsTrue_shouldReturnFalse() { | ||
when(appConfiguration.getDisableAuthnForMaxAgeZero()).thenReturn(true); | ||
assertFalse(authorizeRestWebServiceValidator.isAuthnMaxAgeValid(0, new SessionId(), new Client())); | ||
} | ||
|
||
@Test | ||
public void isAuthnMaxAgeValid_whenMaxAgeIsNull_shouldReturnTrue() { | ||
assertTrue(authorizeRestWebServiceValidator.isAuthnMaxAgeValid(0, new SessionId(), new Client())); | ||
} | ||
} |
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
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
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