public static boolean validateRegistrationProfile(RegistrationProfile registrationProfile) { boolean status = true; if (registrationProfile.getGrantType() == null) { status = false; log.warn( "Required parameter 'grant-type' is missing for initiating Dynamic-Client " + "registration for webapp : " + registrationProfile.getClientName()); } if (registrationProfile.getTokenScope() == null) { status = false; log.warn( "Required parameter 'token-scope' is missing for initiating Dynamic-Client " + "registration for webapp : " + registrationProfile.getClientName()); } return status; }
public static RegistrationProfile constructRegistrationProfile( ServletContext servletContext, String webAppName) { RegistrationProfile registrationProfile = new RegistrationProfile(); registrationProfile.setGrantType( servletContext.getInitParameter( DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_GRANT_TYPE)); registrationProfile.setTokenScope( servletContext.getInitParameter( DynamicClientWebAppRegistrationUtil.OAUTH_PARAM_TOKEN_SCOPE)); registrationProfile.setOwner(DynamicClientWebAppRegistrationUtil.getUserName()); // TODO : Need to get the hostname properly registrationProfile.setCallbackUrl("http://localhost:9763/" + webAppName); registrationProfile.setClientName(webAppName); registrationProfile.setSaasApp( Boolean.parseBoolean( servletContext.getInitParameter( DynamicClientWebAppRegistrationUtil.SP_PARAM_SAAS_APP))); return registrationProfile; }