Search in sources :

Example 11 with TokenLdap

use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.

the class GrantServiceTest method createTestToken.

private TokenLdap createTestToken() {
    final String id = GrantService.generateGrantId();
    final String grantId = GrantService.generateGrantId();
    final String dn = grantService.buildDn(id, grantId, m_clientId);
    final TokenLdap t = new TokenLdap();
    t.setId(id);
    t.setDn(dn);
    t.setGrantId(grantId);
    t.setClientId(m_clientId);
    t.setTokenCode(TEST_TOKEN_CODE);
    t.setTokenType(TokenType.ACCESS_TOKEN.getValue());
    t.setCreationDate(new Date());
    t.setExpirationDate(new Date());
    return t;
}
Also used : TokenLdap(org.xdi.oxauth.model.ldap.TokenLdap) Date(java.util.Date)

Example 12 with TokenLdap

use of org.xdi.oxauth.model.ldap.TokenLdap in project oxAuth by GluuFederation.

the class GrantServiceTest method testCleanUp.

@Test(dependsOnMethods = "createTestToken")
public void testCleanUp() {
    // clean up must remove just created token
    grantService.cleanUp();
    // because expiration is set to new Date()
    final TokenLdap t = grantService.getGrantsByCode(TEST_TOKEN_CODE);
    Assert.assertTrue(t == null);
}
Also used : TokenLdap(org.xdi.oxauth.model.ldap.TokenLdap) BaseComponentTest(org.xdi.oxauth.BaseComponentTest) Test(org.testng.annotations.Test)

Aggregations

TokenLdap (org.xdi.oxauth.model.ldap.TokenLdap)12 Date (java.util.Date)2 JwtAuthorizationRequest (org.xdi.oxauth.model.authorize.JwtAuthorizationRequest)2 LDAPException (com.unboundid.ldap.sdk.LDAPException)1 SignatureException (java.security.SignatureException)1 Calendar (java.util.Calendar)1 List (java.util.List)1 BatchOperation (org.gluu.site.ldap.persistence.BatchOperation)1 Test (org.testng.annotations.Test)1 BaseComponentTest (org.xdi.oxauth.BaseComponentTest)1 OAuth2AuditLog (org.xdi.oxauth.model.audit.OAuth2AuditLog)1 AuthorizationGrant (org.xdi.oxauth.model.common.AuthorizationGrant)1 MemcachedGrant (org.xdi.oxauth.model.common.MemcachedGrant)1 InvalidJweException (org.xdi.oxauth.model.exception.InvalidJweException)1 InvalidJwtException (org.xdi.oxauth.model.exception.InvalidJwtException)1 Grant (org.xdi.oxauth.model.ldap.Grant)1