@Override public boolean isFullyAuthenticated() { return wrapped.isFullyAuthenticated(); } }
/** * Returns <code>true</code> if the authentication only contains client, no user. */ default boolean isClientOnly() { return hasClient() && (getUser() == null || getUser().isAnonymous()); }
/** * Returns true if the user is not null and not anonymous. */ default boolean isUserAuthenticated() { return null != getUser() && !getUser().isAnonymous(); }
/** * Returns <code>true</code> if the user is authenticated and not remember-me. */ default boolean isFullyAuthenticated() { return isAuthenticated() && !isRememberMe(); } }
@Override public Object getValue() { SecurityContext sc = SecurityContext.tryGetCurrent(); UserPrincipal user = null == sc ? null : sc.getUser(); return user == null ? ANONYMOUS : user; }
@Override public Object getValue() { SecurityContext sc = SecurityContext.tryGetCurrent(); ClientPrincipal client = null == sc ? null : sc.getClient(); return client == null ? ANONYMOUS : client; }
/** * Returns <code>true</code> if the authentication is authenticated. */ default boolean isAuthenticated() { return isUserAuthenticated() || isClientAuthenticated(); }
/** * Required. Returns the {@link UserPrincipal}. */ public UserPrincipal getUser() { return null == authentication ? null : authentication.getUser(); }
/** * Returns true if client is not null and not anonymous. */ default boolean isClientAuthenticated() { return null != getClient() && !getClient().isAnonymous(); }
@Override public void setToken(String token) throws IllegalStateException { wrapped.setToken(token); }
@Override public boolean isAuthenticated() { return null != user && !user.isAnonymous(); }
/** * Returns the {@link Authorization} in current request. */ public static Authorization authorization() { return current().getAuthorization(); }
@Override public String toString() { return "Client[id=" + client.getIdAsString() + "]"; } }
/** * Returns true if the client is not null. */ default boolean hasClient() { return null != getClient(); }
@Override public String getAccessMode() { return wrapped.getAccessMode(); }
/** * Returns the {@link Authentication} in current request. */ public static Authentication authentication() { return current().authentication; }
@Override public SimpleSecurity build() { return new SimpleSecurity(userRequired, clientRequired, permissions, roles); } }
public boolean matchAuthentication(Authentication authc) { if(!userRequired) { return !clientRequired ? true : authc.isClientAuthenticated(); } if(!clientRequired) { return authc.isUserAuthenticated(); } return authc.isUserAuthenticated() && authc.isClientAuthenticated(); }
@Override public void setToken(String token) throws IllegalStateException { wrapped.setToken(token); }