Package org.springframework.security.oauth2.provider.request

Examples of org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory


  private static final String USERNAME = "username";

  public String extractKey(OAuth2Authentication authentication) {
    Map<String, String> values = new LinkedHashMap<String, String>();
    OAuth2Request authorizationRequest = authentication.getOAuth2Request();
    if (!authentication.isClientOnly()) {
      values.put(USERNAME, authentication.getName());
    }
    values.put(CLIENT_ID, authorizationRequest.getClientId());
    if (authorizationRequest.getScope() != null) {
      values.put(SCOPE, OAuth2Utils.formatParameterList(authorizationRequest.getScope()));
    }
    MessageDigest digest;
    try {
      digest = MessageDigest.getInstance("MD5");
    }
View Full Code Here


    refreshToken = Mockito.mock(OAuth2RefreshTokenEntity.class);
    Mockito.when(tokenRepository.getRefreshTokenByValue(refreshTokenValue)).thenReturn(refreshToken);
    Mockito.when(refreshToken.getClient()).thenReturn(client);
    Mockito.when(refreshToken.isExpired()).thenReturn(false);

    tokenRequest = new TokenRequest(null, clientId, null, null);

    storedAuthentication = authentication;
    storedAuthRequest = clientAuth;
    storedAuthHolder = Mockito.mock(AuthenticationHolderEntity.class);
    storedScope = Sets.newHashSet(scope);
View Full Code Here

    return newClient;
  }
 
  private OAuth2AccessTokenEntity fetchValidRegistrationToken(OAuth2Authentication auth, ClientDetailsEntity client) {
   
    OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
    OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
   
    if (config.getRegTokenLifeTime() != null) {
   
      try {
        // Re-issue the token if it has been issued before [currentTime - validity]
View Full Code Here

    return newClient;
  }
 
  private OAuth2AccessTokenEntity fetchValidRegistrationToken(OAuth2Authentication auth, ClientDetailsEntity client) {
   
    OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
    OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
   
    if (config.getRegTokenLifeTime() != null) {
   
      try {
        // Re-issue the token if it has been issued before [currentTime - validity]
View Full Code Here

    @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
    private static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {<% if (authenticationType == 'token') { %>

        @Override
        protected MethodSecurityExpressionHandler createExpressionHandler() {
            return new OAuth2MethodSecurityExpressionHandler();
        }<% } %>
View Full Code Here

  private OAuth2RequestFactory defaultOAuth2RequestFactory;

  public void afterPropertiesSet() throws Exception {
    Assert.state(tokenGranter != null, "TokenGranter must be provided");
    Assert.state(clientDetailsService != null, "ClientDetailsService must be provided");
    defaultOAuth2RequestFactory = new DefaultOAuth2RequestFactory(getClientDetailsService());
    if (oAuth2RequestFactory == null) {
      oAuth2RequestFactory = defaultOAuth2RequestFactory;
    }
  }
View Full Code Here

    @Lazy
    @Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
    public SparklrUserApprovalHandler userApprovalHandler() throws Exception {
      SparklrUserApprovalHandler handler = new SparklrUserApprovalHandler();
      handler.setApprovalStore(approvalStore());
      handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService));
      handler.setClientDetailsService(clientDetailsService);
      handler.setUseApprovalStore(true);
      return handler;
    }
View Full Code Here

    @Bean
    public ApprovalStoreUserApprovalHandler userApprovalHandler() {
      ApprovalStoreUserApprovalHandler handler = new ApprovalStoreUserApprovalHandler();
      handler.setApprovalStore(approvalStore());
      handler.setClientDetailsService(clientDetailsService);
      handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService));
      return handler;
    }
View Full Code Here

    handler.setApprovalStore(store);
    InMemoryClientDetailsService clientDetailsService = new InMemoryClientDetailsService();
    Map<String, ClientDetails> map = new HashMap<String, ClientDetails>();
    map.put("client", new BaseClientDetails("client", null, "read,write", "authorization_code", null));
    clientDetailsService.setClientDetailsStore(map);
    handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService));
    userAuthentication = new UsernamePasswordAuthenticationToken("user", "N/A",
        AuthorityUtils.commaSeparatedStringToAuthorityList("USER"));
  }
View Full Code Here

  private OAuth2RequestFactory requestFactory() {
    if (requestFactory != null) {
      return requestFactory;
    }
    requestFactory = new DefaultOAuth2RequestFactory(clientDetailsService());
    return requestFactory;
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.