Search in sources :

Example 1 with RequestObjectDAOImpl

use of org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl in project identity-inbound-auth-oauth by wso2-extensions.

the class RequestObjectServiceTest method testGetRequestedClaimsForUserInfo.

@Test
public void testGetRequestedClaimsForUserInfo() throws Exception {
    RequestObjectDAOImpl requestObjectDAO = new RequestObjectDAOImpl();
    requestObjectService.addRequestObject(consumerKey, sessionKey, requestedEssentialClaims);
    addToken(token, tokenId);
    requestObjectDAO.updateRequestObjectReferencebyTokenId(sessionKey, tokenId);
    List<RequestedClaim> claims = requestObjectService.getRequestedClaimsForUserInfo(token);
    Assert.assertEquals(claims.get(0).getName(), "email");
}
Also used : RequestedClaim(org.wso2.carbon.identity.openidconnect.model.RequestedClaim) RequestObjectDAOImpl(org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl) Test(org.testng.annotations.Test)

Example 2 with RequestObjectDAOImpl

use of org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl in project identity-inbound-auth-oauth by wso2-extensions.

the class RequestObjectServiceTest method testGetRequestedClaimsForUserInfoException.

@Test(expectedExceptions = { IdentityOAuth2Exception.class })
public void testGetRequestedClaimsForUserInfoException() throws Exception {
    RequestObjectDAOImpl requestObjectDAO = new RequestObjectDAOImpl();
    requestObjectService.addRequestObject(consumerKey, sessionKey, requestedEssentialClaims);
    requestObjectDAO.updateRequestObjectReferencebyTokenId(sessionKey, invalidTokenId);
    addToken(token, tokenId);
    List<RequestedClaim> claims = requestObjectService.getRequestedClaimsForUserInfo(token);
    Assert.assertEquals(claims.get(0).getName(), "email");
}
Also used : RequestedClaim(org.wso2.carbon.identity.openidconnect.model.RequestedClaim) RequestObjectDAOImpl(org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl) Test(org.testng.annotations.Test)

Example 3 with RequestObjectDAOImpl

use of org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl in project identity-inbound-auth-oauth by wso2-extensions.

the class RequestObjectServiceTest method testGetRequestedClaimsForIDToken.

@Test
public void testGetRequestedClaimsForIDToken() throws Exception {
    RequestObjectDAOImpl requestObjectDAO = new RequestObjectDAOImpl();
    addToken(token, tokenId);
    requestObjectService.addRequestObject(consumerKey, sessionKey, requestedEssentialClaims);
    requestObjectDAO.updateRequestObjectReferencebyTokenId(sessionKey, tokenId);
    List<RequestedClaim> claims = requestObjectService.getRequestedClaimsForIDToken(token);
    Assert.assertEquals(claims.get(0).getName(), "address");
}
Also used : RequestedClaim(org.wso2.carbon.identity.openidconnect.model.RequestedClaim) RequestObjectDAOImpl(org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl) Test(org.testng.annotations.Test)

Example 4 with RequestObjectDAOImpl

use of org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl in project identity-inbound-auth-oauth by wso2-extensions.

the class RequestObjectDAOImplTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    requestObjectDAO = new RequestObjectDAOImpl();
    requestedEssentialClaims = new ArrayList<>();
    List lstRequestedClaims = new ArrayList<>();
    List values = new ArrayList<>();
    RequestedClaim requestedClaim = new RequestedClaim();
    requestedClaim.setName("email");
    requestedClaim.setType("userinfo");
    requestedClaim.setValue("value1");
    requestedClaim.setEssential(true);
    requestedClaim.setValues(values);
    values.add("val1");
    values.add("val2");
    requestedClaim.setValues(values);
    lstRequestedClaims.add(requestedClaim);
    requestedEssentialClaims.add(lstRequestedClaims);
}
Also used : RequestedClaim(org.wso2.carbon.identity.openidconnect.model.RequestedClaim) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

RequestedClaim (org.wso2.carbon.identity.openidconnect.model.RequestedClaim)4 Test (org.testng.annotations.Test)3 RequestObjectDAOImpl (org.wso2.carbon.identity.openidconnect.dao.RequestObjectDAOImpl)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BeforeClass (org.testng.annotations.BeforeClass)1