I am having trouble programmatically enabling versioning of an existing bucket using AWS SDK iOS v2.1.1. The error is -[NSNull _fastCharacterContents]: unrecognized selector sent to instance .... My snippet of code that creates the error results from executing the putBucketVersioning method:
AWSS3VersioningConfiguration *conf = [AWSS3VersioningConfiguration new];
conf.status = AWSS3BucketVersioningStatusEnabled;
AWSS3PutBucketVersioningRequest *versionRequest = [AWSS3PutBucketVersioningRequest new];
versionRequest.bucket = createBucketReq.bucket;
versionRequest.versioningConfiguration = conf;
[[[AWSS3 S3ForKey:key] putBucketVersioning:versionRequest] continueWithBlock:^id(BFTask *task) {
return task;
}
I am probably missing an argument in how I create the AWSS3PutBucketVersioningRequest request, but I cant find any examples or documentation that will point me in the right direction. Any suggestions in Java, Cocoa, or Swift are very welcome. Cheers, Trond
UPDATE:
Based on comments I am including the full method and the error output after having enabled AWSLogging verbose.
-(BFTask*) enableVersioningOfBucket:(NSString*)bucket region:(NSInteger) region {
[self setupCredentialsForRegion:region];
NSString *key = [NSString stringWithFormat:#"regionkey%li",region];
AWSS3VersioningConfiguration *conf = [AWSS3VersioningConfiguration new];
conf.status = AWSS3BucketVersioningStatusEnabled;
AWSS3PutBucketVersioningRequest *versionRequest = [AWSS3PutBucketVersioningRequest new];
versionRequest.bucket = bucket;
versionRequest.versioningConfiguration = conf;
NSLog(#"Config %#",versionRequest);
return [[[AWSS3 S3ForKey:key] putBucketVersioning:versionRequest] continueWithBlock:^id(BFTask *task) {
NSLog(#"Put bucket versioning %# - %#", task, task.result);
return task;
}];
}
Log message:
2015-06-06 12:09:41.822 connectS3[50137:6337899] Config <AWSS3PutBucketVersioningRequest: 0x600000082350> {
bucket = testbucket;
versioningConfiguration = "<AWSS3VersioningConfiguration: 0x600000024bc0> {\n MFADelete = 0;\n status = 1;\n}";}
2015-06-06 12:09:41.832 connectS3[50137:6337899] -[NSNull _fastCharacterContents]: unrecognized selector sent to instance 0x7fff7724c210
Update 2
The image below shows the stack trace as the error message has just appeared when I use a break-point and step into each method call.
Update 3
I setup my credentials as described below. This works fine for all of my other methods connecting with S3 except for enabling versioning.
AWSStaticCredentialsProvider *credentialsProvider = [[AWSStaticCredentialsProvider alloc ]
initWithAccessKey:keychainStore[ACCESS_KEY_ID]
secretKey:keychainStore[SECRET_KEY]];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:region
credentialsProvider:credentialsProvider];
/* One credential configuration for each region **/
NSString *key = [NSString stringWithFormat:#"regionkey%li",region];
[AWSS3 registerS3WithConfiguration:configuration forKey:key];
/* Default credentialsProvider **/
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
Thanks for your help!
I can confirm it is a bug in current AWS Mobile SDK. we will fix it in future release. Thanks for the reporting.
For a workaround, you can add the following line to your AWSS3VersioningConfiguration code:
AWSS3VersioningConfiguration *conf = [AWSS3VersioningConfiguration new];
conf.status = AWSS3BucketVersioningStatusEnabled;
conf.MFADelete = AWSS3MFADeleteDisabled; // <------ Add this line
...
Related
I am reading the GA4 info according to the code sample provided here in Google Developers Documentation.
I do not know how to check if there are more pages? looking at the result's size I guess I am missing something. Supposing "credentialsJsonPath" contains info for credentials, my code is something like this:
Files.createDirectories(Paths.get(credentialsJsonPath).getParent());
GoogleCredentials credentials =
GoogleCredentials.fromStream(new FileInputStream(credentialsJsonPath));
BetaAnalyticsDataSettings betaAnalyticsDataSettings =
BetaAnalyticsDataSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credentials))
.build();
try (BetaAnalyticsDataClient analyticsData =
BetaAnalyticsDataClient.create(betaAnalyticsDataSettings)) {
RunReportRequest request =
RunReportRequest.newBuilder()
.setProperty("properties/" + "my propertyId")
.addDateRanges(DateRange.newBuilder().setStartDate("2022-10-02").setEndDate("2022-11-02"))
.addDimensions(Dimension.newBuilder().setName("fullPageUrl"))
.addDimensions(Dimension.newBuilder().setName("pagePath"))
.addDimensions(Dimension.newBuilder().setName("eventName"))
.addDimensions(Dimension.newBuilder().setName("date"))
.addDimensions(Dimension.newBuilder().setName("customEvent:dim1"))
.addDimensions(Dimension.newBuilder().setName("customEvent:dim2"))
.addDimensions(Dimension.newBuilder().setName("customEvent:dim3"))
.addMetrics(Metric.newBuilder().setName("activeUsers"))
.addMetrics(Metric.newBuilder().setName("engagementRate"))
.addMetrics(Metric.newBuilder().setName("sessions"))
.addMetrics(Metric.newBuilder().setName("eventCount"))
.addMetrics(Metric.newBuilder().setName("userEngagementDuration"))
.addMetrics(Metric.newBuilder().setName("averageSessionDuration"))
.addMetrics(Metric.newBuilder().setName("screenPageViews"))
.addMetrics(Metric.newBuilder().setName("totalUsers"))
.addMetrics(Metric.newBuilder().setName("eventCountPerUser"))
.addMetrics(Metric.newBuilder().setName("bounceRate"))
.build();
RunReportResponse response = analyticsData.runReport(request);
if(response.getRowsList().size()>0) {
for (Row row : response.getRowsList()) {
// Here I read the desired info
}
}
Is there any method that can check something like response.getNextPageToken() or something similar?
Using SocialAuth: v2.3 via Railo CFML Engine, I am getting the following exception thrown:
Railo 3.3.4.003 Error (org.brickred.socialauth.exception.SocialAuthException)
Message facebook is not a provider or valid OpenId URL
Cause org.brickred.socialauth.exception.SocialAuthException
Stacktrace The Error Occurred in
/Users/rountrjf/Sites/ccpd-dev/controllers/socialauth.cfc: line 31
29: manager.setSocialAuthConfig(config);
30: successUrl = "http://dev.ccpd.uc.edu/socialauth/success";
31: providerUrl = manager.getAuthenticationUrl("facebook", successUrl);
Here is a snippet of my CFC code:
public string function login() {
id = params.key;
configFile = expandPath("/SocialAuth/oauth_config.properties");
inputFile = createObject("java","java.io.File").init(configFile);
inputStream = createObject("java", "java.io.FileInputStream").init(inputFile);
SocialAuthConfig = createObject("java","org.brickred.socialauth.SocialAuthConfig").init();
config = SocialAuthConfig.getDefault();
config.load(configFile);
SocialAuthManager = createObject("java","org.brickred.socialauth.SocialAuthManager").init();
manager = SocialAuthManager;
manager.setSocialAuthConfig(config);
successUrl = "http://dev.ccpd.uc.edu/socialauth/success";
providerUrl = manager.getAuthenticationUrl("facebook", successUrl);
Why is it throwing this error? The "configFile" has a property for "facebook" and it configured as shown in step 3 of the "Getting Started" guide.
CONFIG FILE I'M USING
#google
www.google.com.consumer_key = opensource.brickred.com
www.google.com.consumer_secret = YC06FqhmCLWvtBg/O4W/aJfj
#you can set custom permission by using custom_permissions with provider prefix.
#www.google.com.custom_permissions = http://www.google.com/m8/feeds/,http://picasaweb.google.com/data/
#yahoo
api.login.yahoo.com.consumer_key = dj0yJmk9VTdaSUVTU3RrWlRzJmQ9WVdrOWNtSjZNMFpITm1VbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iMA--
api.login.yahoo.com.consumer_secret = 1db3d0b897dac60e151aa9e2499fcb2a6b474546
#twitter
twitter.com.consumer_key = E3hm7J9IQbWLijpiQG7W8Q
twitter.com.consumer_secret = SGKNuXyybt0iDdgsuzVbFHOaemV7V6pr0wKwbaT2MH0
#facebook
graph.facebook.com.consumer_key = 152190004803645
graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4
#you can set custom permission by using custom_permissions with provider prefix.
#graph.facebook.com.custom_permission = publish_stream,email,user_birthday,user_location,offline_access
#hotmail
consent.live.com.consumer_key = 000000004403D60E
consent.live.com.consumer_secret = cYqlii67pTvgPD4pdB7NUVC7L4MIHCcs
#AOL
api.screenname.aol.com.consumer_key = ab1QxoYXlT-x-ARL
api.screenname.aol.com.consumer_secret = 000
#LinkedIn
api.linkedin.com.consumer_key = 9-mmqg28fpMocVuAg87exH-RXKs70yms52GSFIqkZN25S3m96kdPGBbuSxdSBIyL
api.linkedin.com.consumer_secret = e6NBqhDYE1fX17RwYGW5vMp25Cvh7Sbw9t-zMYTIW_T5LytY5OwJ12snh_YftgE4
#MySpace
api.myspace.com.consumer_key = 29db395f5ee8426bb90b1db65c91c956
api.myspace.com.consumer_secret = 0fdccc829c474e42867e16b68cda37a4c4b7b08eda574fe6a959943e3e9be709
#FourSquare
foursquare.com.consumer_key = JQKEM1PHWFW4YF2YPEQBRRESXE3SBGNCYJWWDTZKF3IZNJ3V
foursquare.com.consumer_secret = 4IILLDFDVPP2LC554S4KXKETQNTDKPDSEVCKVHA2QEHKYBEQ
#Yammer
www.yammer.com.consumer_key=5zyIkp12TrkulSRbSegQ
www.yammer.com.consumer_secret=zUcCB9kqWhI1IiTAJbl9QdG2AWcUJMDWp3Qyv5VJJw
#Mendeley
api.mendeley.com.consumer_key=f31077a7576d5e02537e232eb649403c04fce1dd0
api.mendeley.com.consumer_secret=1810bc92d4625f673e4ff35cb248aab3
#Salesforce
login.salesforce.com.consumer_key = 3MVG9Y6d_Btp4xp4yFMR0tPSndkAVu4OBejuYcL2iGFC68tA49PknWKX20XdPl5s1iwWldyuAbSINWHbB2Jcu
login.salesforce.com.consumer_secret = 1993703471433041656
I would suggest using Constants.FACEBOOK which is actually "facebook" but in case it isn't it has a value that should work.
A possible reason that the error appears is that you are not using the correct input file.
Make sure that the configuration config is loaded correctly,
try to call config.getProviderConfig(Constants.FACEBOOK) and see if it returns null
Lastly you can try this. This is what I used and works.
SocialAuthConfig config = new SocialAuthConfig();
SocialAuthManager socialAuthManager = new SocialAuthManager();
config.load(inputStream);
socialAuthManager.setSocialAuthConfig(config);
I don't really know Railo CFML Engine and what it does so I can't help.
Maybe remove .getDefault() from config = SocialAuthConfig.getDefault();?
when i try to setExpressCheckout, i get ack = success but not token return.
the version of paypal api is 87.0
Here the wsdl link : https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl
here to command i use in axis2-1.6.1 to generate java code
-uri https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsd -p com.paypal.soap
here the link to the java code that generated using axis2 https://docs.google.com/open?id=0B97cB4uxjmztbGgxRER6VjBWcWc
here the code for SetExpressCheckout
PaymentDetailsType paymentDetails = new PaymentDetailsType();
BasicAmountType orderTotal = new BasicAmountType();
orderTotal.setCurrencyID(CurrencyCodeType.USD);
orderTotal.setString("10.00");
paymentDetails.setOrderTotal(orderTotal);
paymentDetails.setPaymentAction(PaymentActionCodeType.Sale);
SetExpressCheckoutRequestDetailsType requestDetailsType = new SetExpressCheckoutRequestDetailsType();
requestDetailsType.setCancelURL(buyer.getCancelUrl());
requestDetailsType.setReturnURL(buyer.getReturnUrl());
requestDetailsType.setPaymentDetails(new PaymentDetailsType[]{paymentDetails});
SetExpressCheckoutRequestType requestType = new SetExpressCheckoutRequestType();
requestType.setVersion("87.0");
requestType.setSetExpressCheckoutRequestDetails(requestDetailsType);
SetExpressCheckoutReq req = new SetExpressCheckoutReq();
req.setSetExpressCheckoutRequest(requestType);
RequesterCredentials requesterCredentials = new RequesterCredentials();
CustomSecurityHeaderType customSecurityHeaderType = new CustomSecurityHeaderType();
UserIdPasswordType userIdPasswordType = new UserIdPasswordType();
userIdPasswordType.setUsername("<username>");
userIdPasswordType.setPassword("<pass>");
userIdPasswordType.setSignature("<signature>");
customSecurityHeaderType.setCredentials(userIdPasswordType);
requesterCredentials.setRequesterCredentials(customSecurityHeaderType);
String endPoint = null;
endPoint = "https://api-3t.sandbox.paypal.com/2.0/"; //sandbox API Signature
PayPalAPIInterfaceServiceStub stub = new PayPalAPIInterfaceServiceStub(endPoint);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
SetExpressCheckoutResponse setExpressCheckout = stub.setExpressCheckout(req, requesterCredentials);
SetExpressCheckoutResponseType checkoutResponse = setExpressCheckout.getSetExpressCheckoutResponse();
Calendar timestamp = checkoutResponse.getTimestamp();
String strdate = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
if (timestamp != null) {
strdate = sdf.format(timestamp.getTime());
}
System.out.println("Date:" + strdate);
System.out.println("CorrelationID:" + checkoutResponse.getCorrelationID());
System.out.println("ack :" + checkoutResponse.getAck());
if (checkoutResponse.getErrors() != null && checkoutResponse.getErrors().length > 0) {
PayPalAPIInterfaceServiceStub.ErrorType[] errors = checkoutResponse.getErrors();
for (int i = 0; i < errors.length; i++) {
System.out.println(errors[i].getErrorCode());
System.out.println(errors[i].getLongMessage());
}
}
System.out.println("token:" + checkoutResponse.getToken());
here the result that i get
Date:17/04/2012 12:33:38
CorrelationID:a7c9fe7283bd
ack :Success
token:null
how i get ack success but token is null?
the contact person for paypal said that there is an EC token already be generated for CorrelationID:a7c9fe7283bd .
thanks in advance.
i have to use setExpressCheckoutResponse.getExtraElement().getText() to get the token. why setExpressCheckoutResponse.getToken() return null?
If you look into mentioned wsdl file, at the beginning you'll notice the following:
<wsdl:definitions
ns:version="89.0"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
... >
Meaning that the version of API which should be used is 89.0 - don't remember where it's specified in PayPal API documentation, but this was mentioned there for sure.
Let me know if you still encounter this issue, since I've managed to set up PayPal Express Checkout using SOAP in Java recently and can help with that.
I just came across this issue and found the answer (this is for C#, I am not sure if it applies to Java):
https://www.x.com/developers/paypal/forums/soap/paypal-api-aa-and-net-wcf-undeserialized-fields
Look in the generated code for the web service (Reference.cs) and find the AbstractResponseType. The last property is Any(). Change the attribute to match this (to ignore the property):
[System.Xml.Serialization.XmlIgnoreAttribute()]
public System.Xml.XmlElement Any {
get {
return this.anyField;
}
set {
this.anyField = value;
}
}
Following this, recompile and test again and you should now receive the Token property set correctly.
If you regenerate the web service code, this change will of course get replaced and you will have to re-do it unless PayPal fixes this. BTW, my WSDL Version number is 98.0 at this time.
Gary Davis
I'm trying to get the LDAP plugin work. I only want a LDAP authentication against an Active Directory but it seems that I'm missing something.
Config
grails {
plugins {
springsecurity {
userLookup.userDomainClassName = 'de.ac.dmf.security.User'
userLookup.authorityJoinClassName = 'de.ac.dmf.security.UserRole'
authority.className = 'de.ac.dmf.security.Role'
ldap {
context.managerDn = 'CN=dmf Systemuser,CN=Users,DC=dmf,DC=local'
context.managerPassword = 'Password1'
context.server = 'ldap://192.168.100.133:389/'
authorities{
groupSearchBase ='OU=Groups'
groupSearchFilter = '(member={0})'
retrieveGroupRoles = false
retrieveDatabaseRoles = false
defaultRole = 'USER'
ignorePartialResultException = true
}
search{
base = 'CN=Users,DC=dmf,DC=local'
filter = '(sAMAccountName={0})'
searchSubtree = true
}
// mapper.userDetailsClass = 'user'
// auth.hideUserNotFoundExceptions = false
useRememberMe = false
}
}
}
}
On every login I just get this exception
2011-04-29 08:49:09,129 [http-8080-1] DEBUG springsecurity.RequestHolderAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.AuthenticationServiceException: [LDAP: error code 32 - 0000208D: NameErr: DSID-031001E4, problem 2001 (NO_OBJECT), data 0, best match of:
'CN=Users,DC=dmf,DC=local'; remaining name 'CN=Users,DC=dmf,DC=local'
It doesn't matter which user from my AD I'm trying to authenticate. Is my configuration wrong?
I'm using
Grails 1.3.7
spring-security-core 1.1.2
spring-security-ldap 1.04
are you sure about your base configuration? Looks like OU=Users could work instead of CN=Users. Easiest way to figure this out is to use a tool like ad explorer (http://technet.microsoft.com/de-de/sysinternals/bb963907), connect to your AD, browse to a user and take a look at the path to the user...
Try using:
filter = '(&(sAMAccountName={0})(objectclass=user))'
That works on our AD.
You are missing the provider name list.
grails.plugins.springsecurity.providerNames = ['ldapAuthProvider',
'anonymousAuthenticationProvider',
'rememberMeAuthenticationProvider']
I hope someone here has experience with Sun OpenSSO (now ForgeRock OpenAM).
I'm trying to get all groups in ActiveDirectory using the OpenSSO Client SDK in Java / JBoss EAP 5.0.
I tried the following by combining various samples and code snippets I could find on the web, but this fails and eventually logs "Memberships for identities other than Users is not allowed." The basic approach was to use AMIdentityRepository -> getRealmIdentity() -> getMemberships(IdType.GROUP) :
SSOTokenManager manager = SSOTokenManager.getInstance();
String tokenString = URLDecoder.decode(tokenID, "ISO-8859-1");
SSOToken token = manager.createSSOToken(tokenString);
if (manager.isValidToken(token)) {
SSOToken adminToken = (SSOToken)AccessController.
doPrivileged(AdminTokenAction.getInstance());
AMIdentityRepository rep = new AMIdentityRepository(adminToken, "/");
AMIdentity identity = rep.getRealmIdentity();
Set groups = identity.getMemberships(IdType.GROUP);
}
Note I'm not trying to determine if a user is a member of a group or to retrieve a user's groups - I'm trying to get a list of ALL groups.
Any suggestions would be appreciated - thanks!
Instead of rep.getRealmIdentity() and then calling getMemberships(IdType.GROUP), use searchIdentities and getSearchResults like:
SSOToken token = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
AMIdentityRepository ir = new AMIdentityRepository(token, "/");
IdSearchResults results = ir.searchIdentities(IdType.GROUP, "*", new IdSearchControl());
Set<AMIdentity> groups = results.getSearchResults();
for (AMIdentity group : groups) {
logger.debug("Group Name : " + group.getName());
}