List of usage examples for org.springframework.security.oauth2.client.token.grant.password ResourceOwnerPasswordResourceDetails setClientAuthenticationScheme
public void setClientAuthenticationScheme(AuthenticationScheme clientAuthenticationScheme)
From source file:com.bcknds.demo.oauth2.util.AuthenticationUtil.java
/** * Gets an OAuth2RestTemplate with the password configuration setup and ready to use. * /*from w w w . ja va 2s. co m*/ * @return */ public static OAuth2RestTemplate getPasswordCredentials(final String username, final String password) { SSLCertificateValidation.disable(); ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails(); resource.setClientAuthenticationScheme(AuthenticationScheme.header); resource.setClientId(BaseTest.PASSWORD_CLIENTID); resource.setScope(BaseTest.PASSWORD_SCOPE); resource.setId(BaseTest.PASSWORD_RESOURCEID); resource.setUsername(username); resource.setPassword(password); resource.setClientSecret(BaseTest.PASSWORD_SECRET); resource.setAccessTokenUri(BaseTest.ACCESS_TOKEN_URI); return new OAuth2RestTemplate(resource); }
From source file:org.cloudfoundry.client.lib.oauth2.OauthClient.java
private OAuth2ProtectedResourceDetails getResourceDetails(String username, String password, String clientId, String clientSecret) {//from w ww . ja va2 s .co m ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails(); resource.setUsername(username); resource.setPassword(password); resource.setClientId(clientId); resource.setClientSecret(clientSecret); resource.setId(clientId); resource.setClientAuthenticationScheme(AuthenticationScheme.header); resource.setAccessTokenUri(authorizationUrl + "/oauth/token"); return resource; }
From source file:com.create.application.configuration.ResourceOwnerPasswordResourceDetailsBuilder.java
public ResourceOwnerPasswordResourceDetails build() { ResourceOwnerPasswordResourceDetails resourceOwnerPasswordResourceDetails = new ResourceOwnerPasswordResourceDetails(); resourceOwnerPasswordResourceDetails.setUsername(username); resourceOwnerPasswordResourceDetails.setPassword(password); resourceOwnerPasswordResourceDetails.setId(id); resourceOwnerPasswordResourceDetails.setGrantType(grantType); resourceOwnerPasswordResourceDetails.setClientId(clientId); resourceOwnerPasswordResourceDetails.setAccessTokenUri(accessTokenUri); resourceOwnerPasswordResourceDetails.setScope(scope); resourceOwnerPasswordResourceDetails.setClientSecret(clientSecret); resourceOwnerPasswordResourceDetails.setClientAuthenticationScheme(clientAuthenticationScheme); resourceOwnerPasswordResourceDetails.setTokenName(tokenName); return resourceOwnerPasswordResourceDetails; }
From source file:org.cloudfoundry.identity.uaa.integration.UaaTestAccounts.java
@Override public ResourceOwnerPasswordResourceDetails getResourceOwnerPasswordResource(String[] scope, String clientId, String clientSecret, String username, String password) { ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails(); resource.setClientId(clientId);//from w w w . j a v a2 s . c om resource.setClientSecret(clientSecret); resource.setId(clientId); resource.setScope(Arrays.asList(scope)); Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("username", username); parameters.put("password", password); resource.setUsername(username); resource.setPassword(password); resource.setClientAuthenticationScheme(AuthenticationScheme.header); resource.setAccessTokenUri(server.getAccessTokenUri()); return resource; }
From source file:org.cloudfoundry.identity.uaa.test.UaaTestAccounts.java
@Override public ResourceOwnerPasswordResourceDetails getResourceOwnerPasswordResource(String[] scope, String clientId, String clientSecret, String username, String password) { ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails(); resource.setClientId(clientId);//from w w w . j a v a 2 s. c om resource.setClientSecret(clientSecret); resource.setId(clientId); resource.setScope(Arrays.asList(scope)); resource.setUsername(username); resource.setPassword(password); resource.setClientAuthenticationScheme(AuthenticationScheme.header); resource.setAccessTokenUri(server.getAccessTokenUri()); return resource; }