Search in sources :

Example 1 with AccessTokenTO

use of org.apache.syncope.common.lib.to.AccessTokenTO in project syncope by apache.

the class AccessTokenDataBinderImpl method getAccessTokenTO.

@Override
public AccessTokenTO getAccessTokenTO(final AccessToken accessToken) {
    AccessTokenTO accessTokenTO = new AccessTokenTO();
    BeanUtils.copyProperties(accessToken, accessTokenTO, IGNORE_PROPERTIES);
    accessTokenTO.setOwner(accessToken.getOwner());
    return accessTokenTO;
}
Also used : AccessTokenTO(org.apache.syncope.common.lib.to.AccessTokenTO)

Example 2 with AccessTokenTO

use of org.apache.syncope.common.lib.to.AccessTokenTO in project syncope by apache.

the class AccessTokenDirectoryPanel method getColumns.

@Override
protected List<IColumn<AccessTokenTO, String>> getColumns() {
    List<IColumn<AccessTokenTO, String>> columns = new ArrayList<>();
    columns.add(new KeyPropertyColumn<>(new StringResourceModel(Constants.KEY_FIELD_NAME, this), Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
    columns.add(new PropertyColumn<>(new ResourceModel("owner"), "owner", "owner"));
    columns.add(new AbstractColumn<AccessTokenTO, String>(new ResourceModel("issuedAt", "")) {

        private static final long serialVersionUID = -1822504503325964706L;

        @Override
        public void populateItem(final Item<ICellPopulator<AccessTokenTO>> cellItem, final String componentId, final IModel<AccessTokenTO> model) {
            JwsJwtCompactConsumer consumer = new JwsJwtCompactConsumer(model.getObject().getBody());
            cellItem.add(new Label(componentId, SyncopeConsoleSession.get().getDateFormat().format(new Date(consumer.getJwtClaims().getIssuedAt()))));
        }
    });
    columns.add(new DatePropertyColumn<>(new ResourceModel("expiryTime"), "expiryTime", "expiryTime"));
    return columns;
}
Also used : AccessTokenTO(org.apache.syncope.common.lib.to.AccessTokenTO) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) Date(java.util.Date) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) StringResourceModel(org.apache.wicket.model.StringResourceModel) ResourceModel(org.apache.wicket.model.ResourceModel) JwsJwtCompactConsumer(org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Aggregations

AccessTokenTO (org.apache.syncope.common.lib.to.AccessTokenTO)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 JwsJwtCompactConsumer (org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer)1 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 Label (org.apache.wicket.markup.html.basic.Label)1 ResourceModel (org.apache.wicket.model.ResourceModel)1 StringResourceModel (org.apache.wicket.model.StringResourceModel)1