class UmaTokenStore {

    RequestingPartyToken createRPT(PermissionTicket permissionTicket) throws ServerException, NotFoundException {
        UmaProviderSettings settings = settingsFactory.get(realm);
        Permission permission = new Permission(permissionTicket.getResourceSetId(), permissionTicket.getScopes());
        RequestingPartyToken rpt = new RequestingPartyToken(null, permissionTicket.getResourceServerClientId(),
                asSet(permission), currentTimeMillis() + (settings.getRPTLifetime() * 1000),
                permissionTicket.getId(), permissionTicket.getClientClientId());
        rpt.setRealm(realm);
        try {
            cts.create(rptAdapter.toToken(rpt));
        } catch (CoreTokenException e) {
            throw new ServerException(e);
        }
        return rpt;
    }

    @Inject  UmaTokenStore(@Assisted String realm, JavaBeanAdapter<RequestingPartyToken> rptAdapter,
            JavaBeanAdapter<PermissionTicket> permissionTicketAdapter, CTSPersistentStore cts,
            UmaProviderSettingsFactory settingsFactory);

}