protected String getStringProperty(String key) { final Set<String> value = getParameter(key); if (CollectionUtils.isNotEmpty(value)) { return value.iterator().next(); } return null; }
/** * Gets the expiry time of this device code. * * @return The expiry time (ms since epoch). */ public long getExpiryTime() { final Set<String> value = getParameter(EXPIRE_TIME); if (CollectionUtils.isNotEmpty(value)) { return Long.parseLong(value.iterator().next()); } return 0; }
/** * Gets the set of scopes requested. * * @return The scope values. */ public Set<String> getScope() { final Set<String> value = getParameter(SCOPE); if (CollectionUtils.isNotEmpty(value)) { return value; } return Collections.emptySet(); }
private void populateTableModel(List<SMSubConfig> subConfigs) { CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG); CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel(); tblModel.clearAll(); if (CollectionUtils.isEmpty(subConfigs)) { return; } SerializedField szCache = (SerializedField) getChild(SZ_CACHE); List<SMSubConfig> cache = new ArrayList<>(subConfigs.size()); boolean firstEntry = true; for (SMSubConfig conf : subConfigs) { if (firstEntry) { firstEntry = false; } else { tblModel.appendRow(); } tblModel.setValue(TBL_SUB_CONFIG_DATA_NAME, conf.getName()); tblModel.setValue(TBL_SUB_CONFIG_HREF_NAME, conf.getName()); tblModel.setValue(TBL_SUB_CONFIG_DATA_TYPE, conf.getType()); cache.add(conf); } szCache.setValue(cache); }
private String getAttributeValue(JsonValue token, String attributeName) { Set<String> value = token.get(attributeName).asSet(String.class); if (CollectionUtils.isNotEmpty(value)) { return value.iterator().next(); } return null; }
private String getFailedPrincipal(LoginState loginState) { if (loginState == null) { return null; } String principal = loginState.getUserDN(); if (principal != null) { return DNUtils.DNtoName(principal); } principal = loginState.getFailureTokenId(); if (principal != null) { return principal; } if (CollectionUtils.isNotEmpty(loginState.getAllReceivedCallbacks())) { for (Callback[] cb : loginState.getAllReceivedCallbacks().values()) { for (Callback aCb : cb) { if (aCb instanceof NameCallback) { return ((NameCallback) aCb).getName(); } } } } return null; }
@BeforeClass @SuppressWarnings("unchecked") public void setUp() { JacksonRepresentationFactory jacksonRepresentationFactory = new JacksonRepresentationFactory(new ObjectMapper()); requestFactory = mock(OAuth2RequestFactory.class); accessTokenService = mock(AccessTokenService.class); OAuth2Representation representation = new OAuth2Representation(null); exceptionHandler = new ExceptionHandler(representation, null, null, jacksonRepresentationFactory); hook = mock(TokenRequestHook.class); tokenEndpointResource = new TokenEndpointResource( requestFactory, accessTokenService, exceptionHandler, CollectionUtils.asSet(hook), jacksonRepresentationFactory); }
private void setStringProperty(String key, String value) { if (value != null) { put(key, CollectionUtils.asSet(value)); } }
/** Updates the last poll time of this device code. */ public void poll() { this.put("lastQueried", CollectionUtils.asSet(String.valueOf(System.currentTimeMillis()))); }