/** * This constructor should be used when the Authorization Request/Response is complete. * * @param clientRegistration the client registration * @param authorizationExchange the authorization exchange */ public OAuth2LoginAuthenticationToken(ClientRegistration clientRegistration, OAuth2AuthorizationExchange authorizationExchange) { super(Collections.emptyList()); Assert.notNull(clientRegistration, "clientRegistration cannot be null"); Assert.notNull(authorizationExchange, "authorizationExchange cannot be null"); this.clientRegistration = clientRegistration; this.authorizationExchange = authorizationExchange; this.setAuthenticated(false); }
/** * This constructor should be used when the Access Token Request/Response is complete, * which indicates that the Authorization Code Grant flow has fully completed * and OAuth 2.0 Login has been achieved. * * @param clientRegistration the client registration * @param authorizationExchange the authorization exchange * @param principal the user {@code Principal} registered with the OAuth 2.0 Provider * @param authorities the authorities granted to the user * @param accessToken the access token credential * @param refreshToken the refresh token credential */ public OAuth2LoginAuthenticationToken(ClientRegistration clientRegistration, OAuth2AuthorizationExchange authorizationExchange, OAuth2User principal, Collection<? extends GrantedAuthority> authorities, OAuth2AccessToken accessToken, @Nullable OAuth2RefreshToken refreshToken) { super(authorities); Assert.notNull(clientRegistration, "clientRegistration cannot be null"); Assert.notNull(authorizationExchange, "authorizationExchange cannot be null"); Assert.notNull(principal, "principal cannot be null"); Assert.notNull(accessToken, "accessToken cannot be null"); this.clientRegistration = clientRegistration; this.authorizationExchange = authorizationExchange; this.principal = principal; this.accessToken = accessToken; this.refreshToken = refreshToken; this.setAuthenticated(true); }
/** * This constructor should be used when the Authorization Request/Response is complete. * * @param clientRegistration the client registration * @param authorizationExchange the authorization exchange */ public OAuth2LoginAuthenticationToken(ClientRegistration clientRegistration, OAuth2AuthorizationExchange authorizationExchange) { super(Collections.emptyList()); Assert.notNull(clientRegistration, "clientRegistration cannot be null"); Assert.notNull(authorizationExchange, "authorizationExchange cannot be null"); this.clientRegistration = clientRegistration; this.authorizationExchange = authorizationExchange; this.setAuthenticated(false); }
/** * This constructor should be used when the Access Token Request/Response is complete, * which indicates that the Authorization Code Grant flow has fully completed * and OAuth 2.0 Login has been achieved. * * @param clientRegistration the client registration * @param authorizationExchange the authorization exchange * @param principal the user {@code Principal} registered with the OAuth 2.0 Provider * @param authorities the authorities granted to the user * @param accessToken the access token credential * @param refreshToken the refresh token credential */ public OAuth2LoginAuthenticationToken(ClientRegistration clientRegistration, OAuth2AuthorizationExchange authorizationExchange, OAuth2User principal, Collection<? extends GrantedAuthority> authorities, OAuth2AccessToken accessToken, @Nullable OAuth2RefreshToken refreshToken) { super(authorities); Assert.notNull(clientRegistration, "clientRegistration cannot be null"); Assert.notNull(authorizationExchange, "authorizationExchange cannot be null"); Assert.notNull(principal, "principal cannot be null"); Assert.notNull(accessToken, "accessToken cannot be null"); this.clientRegistration = clientRegistration; this.authorizationExchange = authorizationExchange; this.principal = principal; this.accessToken = accessToken; this.refreshToken = refreshToken; this.setAuthenticated(true); }