@Override
	public PermissionTicket createTicket(ResourceSet resourceSet, Set<String> scopes) {

		// check to ensure that the scopes requested are a subset of those in the resource set

		if (!scopeService.scopesMatch(resourceSet.getScopes(), scopes)) {
			throw new InsufficientScopeException("Scopes of resource set are not enough for requested permission.");
		}

		Permission perm = new Permission();
		perm.setResourceSet(resourceSet);
		perm.setScopes(scopes);

		PermissionTicket ticket = new PermissionTicket();
		ticket.setPermission(perm);
		ticket.setTicket(UUID.randomUUID().toString());
		ticket.setExpiration(new Date(System.currentTimeMillis() + permissionExpirationSeconds * 1000L));

		return repository.save(ticket);

	}
@Test
	public void testCreate_ticket() {

		PermissionTicket perm = permissionService.createTicket(rs1, scopes1);

		// we want there to be a non-null ticket
		assertNotNull(perm.getTicket());
	}