use of lombok.SneakyThrows in project ratauth by alfa-laboratory.
the class OpenIdAuthorizeService method buildResponse.
@SneakyThrows
private static AuthzResponse buildResponse(RelyingParty relyingParty, Session session, VerifyResult verifyResult, TokenCache tokenCache, AuthzRequest authzRequest) {
String redirectUri = authzRequest.getRedirectURI();
final String targetRedirectURI = createRedirectURI(relyingParty, redirectUri);
// in case of autCode sent by authProvider
if (session == null || CollectionUtils.isEmpty(session.getEntries())) {
AuthzResponse resp = AuthzResponse.builder().location(relyingParty.getAuthorizationRedirectURI()).data(verifyResult.getData()).redirectURI(targetRedirectURI).build();
return resp;
}
AuthEntry entry = session.getEntry(relyingParty.getName()).get();
AuthzResponse resp = AuthzResponse.builder().location(entry.getRedirectUrl()).sessionToken(session.getSessionToken()).acrValues(verifyResult.getAcrValues()).data(verifyResult.getData()).build();
final Optional<Token> tokenOptional = entry.getLatestToken();
// implicit auth
if (tokenOptional.isPresent()) {
final Token token = tokenOptional.get();
resp.setToken(token.getToken());
if (tokenCache != null)
resp.setIdToken(tokenCache.getIdToken());
resp.setTokenType(TokenType.BEARER);
resp.setRefreshToken(token.getRefreshToken());
resp.setExpiresIn(token.getExpiresIn().getTime());
} else {
generateAuthCode(relyingParty, session, authzRequest, targetRedirectURI, entry, resp);
}
return resp;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramBlockRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
Map<String, Object> likeMap = new LinkedHashMap<>();
likeMap.put("_uuid", api.getUuid());
likeMap.put("_uid", api.getUserId());
likeMap.put("user_id", userId);
likeMap.put("_csrftoken", api.getOrFetchCsrf());
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(likeMap);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramCheckUsernameRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> payloadMap = new LinkedHashMap<>();
payloadMap.put("username", username);
payloadMap.put("_csrftoken", api.getOrFetchCsrf());
String payloadJson = mapper.writeValueAsString(payloadMap);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramUnlikeRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
Map<String, Object> likeMap = new LinkedHashMap<>();
likeMap.put("_uuid", api.getUuid());
likeMap.put("_uid", api.getUserId());
likeMap.put("_csrftoken", api.getOrFetchCsrf());
likeMap.put("media_id", mediaId);
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(likeMap);
return payloadJson;
}
use of lombok.SneakyThrows in project instagram4j by brunocvcunha.
the class InstagramLoginRequest method getPayload.
@Override
@SneakyThrows
public String getPayload() {
ObjectMapper mapper = new ObjectMapper();
String payloadJson = mapper.writeValueAsString(payload);
return payloadJson;
}
Aggregations