@Override public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); String flag = approvalParameters.get(approvalParameter); boolean approved = flag != null && flag.toLowerCase().equals("true"); authorizationRequest.setApproved(approved); return authorizationRequest; }
@Override public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); String flag = approvalParameters.get(approvalParameter); boolean approved = flag != null && flag.toLowerCase().equals("true"); authorizationRequest.setApproved(approved); return authorizationRequest; }
@Override public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); String flag = approvalParameters.get(approvalParameter); boolean approved = flag != null && flag.toLowerCase().equals("true"); authorizationRequest.setApproved(approved); return authorizationRequest; }
/** * Check if the user has already stored a positive approval decision for this site; or if the * site is whitelisted, approve it automatically. * * Otherwise, return false so that the user will see the approval page and can make their own decision. * * @param authorizationRequest the incoming authorization request * @param userAuthentication the Principal representing the currently-logged-in user * * @return true if the site is approved, false otherwise */ @Override public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { // if this request is already approved, pass that info through // (this flag may be set by updateBeforeApproval, which can also do funny things with scopes, etc) if (authorizationRequest.isApproved()) { return true; } else { // if not, check to see if the user has approved it // TODO: make parameter name configurable? return Boolean.parseBoolean(authorizationRequest.getApprovalParameters().get("user_oauth_approval")); } }
Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); for (String requestedScope : requestedScopes) { String approvalParameter = scopePrefix + requestedScope;
if (Boolean.parseBoolean(authorizationRequest.getApprovalParameters().get("user_oauth_approval"))) { Map<String,String> approvalParams = authorizationRequest.getApprovalParameters(); String remember = authorizationRequest.getApprovalParameters().get("remember"); if (!Strings.isNullOrEmpty(remember) && !remember.equals("none")) {
@Override public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { String flag = authorizationRequest.getApprovalParameters().get(approvalParameter); boolean userApproval = flag != null && flag.toLowerCase().equals("true"); Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); Set<String> approvedScopes = new HashSet<>(); approvedScopes.addAll(autoApprovedScopes);
@Override public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); String flag = approvalParameters.get(approvalParameter); boolean approved = flag != null && flag.toLowerCase().equals("true"); authorizationRequest.setApproved(approved); return authorizationRequest; }
@Override public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); String flag = approvalParameters.get(approvalParameter); boolean approved = flag != null && flag.toLowerCase().equals("true"); authorizationRequest.setApproved(approved); return authorizationRequest; }
/** * Check if the user has already stored a positive approval decision for this site; or if the * site is whitelisted, approve it automatically. * * Otherwise, return false so that the user will see the approval page and can make their own decision. * * @param authorizationRequest the incoming authorization request * @param userAuthentication the Principal representing the currently-logged-in user * * @return true if the site is approved, false otherwise */ @Override public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { // if this request is already approved, pass that info through // (this flag may be set by updateBeforeApproval, which can also do funny things with scopes, etc) if (authorizationRequest.isApproved()) { return true; } else { // if not, check to see if the user has approved it // TODO: make parameter name configurable? return Boolean.parseBoolean(authorizationRequest.getApprovalParameters().get("user_oauth_approval")); } }
/** * Is called if OsiamUserApprovalHandler.isApproved() returns false and AccessConfirmation is done by the user. Than * it will save the approve date to be able to check it as long as user accepts approval. So the user is not * bothered every time to approve the client. * * @param authorizationRequest * spring authorizationRequest * @param userAuthentication * spring userAuthentication * @return the authorizationRequest */ @Override public AuthorizationRequest updateBeforeApproval(final AuthorizationRequest authorizationRequest, final Authentication userAuthentication) { // check if "user_oauth_approval" is in the authorizationRequests approvalParameters and the (size != 0) // -> true for accessConfirmation -> save actual date if (authorizationRequest.getApprovalParameters().containsKey("user_oauth_approval") && authorizationRequest.getApprovalParameters().get("user_oauth_approval").equals("true")) { final OsiamClientDetails client = getClientDetails(authorizationRequest); final Date date = new Date(System.currentTimeMillis() + client.getValidityInSeconds() * MILLISECONDS); client.setExpiry(date); osiamClientDetailsService.updateClientExpiry(authorizationRequest.getClientId(), client.getExpiry()); } return super.updateBeforeApproval(authorizationRequest, userAuthentication); }
if (Boolean.parseBoolean(authorizationRequest.getApprovalParameters().get("user_oauth_approval"))) { Map<String,String> approvalParams = authorizationRequest.getApprovalParameters(); String remember = authorizationRequest.getApprovalParameters().get("remember"); if (!Strings.isNullOrEmpty(remember) && !remember.equals("none")) {
Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters(); for (String requestedScope : requestedScopes) { String approvalParameter = scopePrefix + requestedScope;