Java Code Examples for org.keycloak.common.util.Time#toDate()

The following examples show how to use org.keycloak.common.util.Time#toDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizationBean.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public Date getGrantedDate() {
    if (grantedTimestamp == null) {
        PermissionScopeBean permission = scopes.stream().filter(permissionScopeBean -> permissionScopeBean.isGranted()).findFirst().orElse(null);

        if (permission == null) {
            return null;
        }

        return permission.getGrantedDate();
    }
    return Time.toDate(grantedTimestamp);
}
 
Example 2
Source File: AbstractSessionCacheCommand.java    From keycloak with Apache License 2.0 4 votes vote down vote up
protected String toString(UserSessionEntity userSession) {
    int clientSessionsSize = userSession.getAuthenticatedClientSessions()==null ? 0 : userSession.getAuthenticatedClientSessions().size();
    return "ID: " + userSession.getId() + ", realm: " + userSession.getRealmId()+ ", lastAccessTime: " + Time.toDate(userSession.getLastSessionRefresh()) +
            ", authenticatedClientSessions: " + clientSessionsSize;
}
 
Example 3
Source File: AuthorizationBean.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public Date getCreatedDate() {
    return Time.toDate(createdTimestamp);
}
 
Example 4
Source File: AuthorizationBean.java    From keycloak with Apache License 2.0 4 votes vote down vote up
private Date getGrantedDate() {
    if (isGranted()) {
        return Time.toDate(ticket.getGrantedTimestamp());
    }
    return null;
}
 
Example 5
Source File: SessionsBean.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public Date getStarted() {
    return Time.toDate(session.getStarted());
}
 
Example 6
Source File: SessionsBean.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public Date getLastAccess() {
    return Time.toDate(session.getLastSessionRefresh());
}
 
Example 7
Source File: SessionsBean.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public Date getExpires() {
    int maxLifespan = session.isRememberMe() && realm.getSsoSessionMaxLifespanRememberMe() > 0 ? realm.getSsoSessionMaxLifespanRememberMe() : realm.getSsoSessionMaxLifespan();
    int max = session.getStarted() + maxLifespan;
    return Time.toDate(max);
}