@Override @Cacheable.FlushAfter public void refresh() throws IOException { this.region.table(DefaultUser.TOKENS).put( new Attributes() .with(DefaultUser.HASH, this.name) .with( DefaultUser.ATTR_TOKEN, Joiner.on('-').join( Iterables.limit( Splitter.fixedLength(Tv.FOUR).split( DigestUtils.md5Hex( RandomStringUtils.random(Tv.TEN) ).toUpperCase(Locale.ENGLISH) ), Tv.FOUR ) ) ) ); }
@Override @Cacheable.FlushAfter public void delete(final String name) { Iterators.removeIf( this.table.frame() .through(new QueryValve().withLimit(1)) .where(DyCounters.HASH, Conditions.equalTo(this.owner)) .where(DyCounters.RANGE, Conditions.equalTo(name)) .iterator(), Predicates.alwaysTrue() ); }
/** * Logout authentication cookie. * * <p>Use this cookie to log user out of the system, for example: * * <pre> if (you_are_not_allowed()) { * throw new AuthException( * Response.seeOther(this.uriInfo().getBaseUri()) * .cookie(this.auth().logout()) * .build() * ); * } * </pre> * * @return The cookie */ @Cacheable.FlushAfter public NewCookie logout() { return new CookieBuilder(this.resource.uriInfo().getBaseUri()) .name(AuthInset.AUTH_COOKIE) .build(); }
@Override @Cacheable.FlushAfter public void create(final String name) throws IOException { this.table.put( new Attributes() .with(DyCounters.HASH, this.owner) .with(DyCounters.RANGE, name) .with(DyCounters.ATTR_VALUE, new AttributeValue().withN("0")) ); }
@Override @Cacheable.FlushAfter public Counter create(final String name) throws IOException { return this.origin.create(name); }
@Override @Cacheable.FlushAfter public void delete(final String name) throws IOException { this.origin.delete(name); }