Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
        // dependencies in your pom.xml 
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-facebook</artifactId>
            <version>0.13.0<1</version>
        </dependency>
        <dependency>
            <groupId>org.tynamo.security</groupId>
            <artifactId>tynamo-federatedaccounts-twitter</artifactId>
            <version>0.13.0<1</version>
        </dependency>

        // in your AppModule.java
	public static void bind(ServiceBinder binder) {
		binder.bind(FederatedAccountService.class, DefaultHibernateFederatedAccountServiceImpl.class);
	}

	public static void contributeFederatedAccountService(MappedConfiguration<String, Object> configuration) {
		configuration.add("*", User.class);
		configuration.add("facebook.id", "facebookId");
		configuration.add("twitter.id", "twitterId");
	}

    public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
	// these are the defaults, change as needed
	// configuration.add(FederatedAccountSymbols.COMMITAFTER_OAUTH, "true");
	// configuration.add(FederatedAccountSymbols.HTTPCLIENT_ON_GAE, "false");
        // configuration.add(FederatedAccountSymbols.SUCCESSURL, ""); // empty string implies host name only

	// set your oauth app credentials
	configuration.add(FacebookRealm.FACEBOOK_CLIENTID, "<your oauth client id>");
	configuration.add(FacebookRealm.FACEBOOK_CLIENTSECRET, "<your oauth client secret>");
	configuration.add(TwitterRealm.TWITTER_CLIENTID, "<your oauth client id>");
	configuration.add(TwitterRealm.TWITTER_CLIENTSECRET, "<your oauth client secret>");
    }

...

Code Block
    // dependencies in your pom.xml 
    <dependency>
     <groupId>org.tynamo.security</groupId>
     <artifactId>tynamo-federatedaccounts-rollingtokens</artifactId>
     <version>0.03.2<1</version>
    </dependency>

    @Contribute(FederatedAccountService.class)
	public static void contributeFederatedAccountService(MappedConfiguration<String, Object> configuration) {
        configuration.add("rollingtokens", UserAccount.class);
        configuration.add("rollingtokens" + FederatedAccountService.IDPROPERTY, "id");
	}

	// Need to tell principal type to rolling tokens so it can be persisted properly with the ExpiringRollingToken
    public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
        configuration.add(RollingTokenSymbols.CONFIGURED_PRINCIPALTYPE, Long.class.getName());
    }

	// rollingtokens is currently JPA only
    @Contribute(JpaEntityPackageManager.class)
    public static void addPackagesToScan(Configuration<String> configuration) {
        configuration.add(ExpiringRollingToken.class.getPackage().getName());
    } 

...