Best code examples for Java 8 Subject class (javax.security.auth.Subject)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Subject class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Subject examples from Open Source projects
This code example shows how to use the following methods:
49:	subject = new Subject(); 
-
52:	handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, subject)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getPrincipals
51:	return subject.getPrincipals(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials
158:	module.initialize( 
-
165:	assertEquals(this.subject.getPrincipals().size(), 3); 
166:	assertEquals(TICKET, this.subject.getPrivateCredentials().iterator().next().toString()); 
-
170:	assertEquals(0, subject.getPrincipals().size()); 
171:	assertEquals(0, subject.getPrivateCredentials().size()); 
-
175:	module.initialize( 
-
187:	assertEquals(0, this.subject.getPrincipals().size()); 
188:	assertEquals(0, this.subject.getPrivateCredentials().size()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials
48:	Set<Principal> principals = subject.getPrincipals(); 
-
52:	Set<Object> privateCredentials = subject.getPrivateCredentials(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials, getPublicCredentials
48:	Subject s = new Subject(); 
-
50:	assertTrue("Set of principal is not empty", s.getPrincipals().isEmpty()); 
51:	assertTrue("Set of private credentials is not empty", s.getPrivateCredentials().isEmpty()); 
52:	assertTrue("Set of public credentials is not empty", s.getPublicCredentials().isEmpty()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: doAs
94:	return Subject.doAs(subject, action); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
95:	Subject subject = new Subject(false, principals, new HashSet<Object>(), new HashSet<Object>()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials, getPublicCredentials
38:	Subject subject = new Subject(); 
-
40:	return new Object[] { subject, subject.getPrincipals(), 
41:	subject.getPrivateCredentials(), subject.getPublicCredentials() }; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals
80:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrincipals
98:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPrivateCredentials, getPublicCredentials
42:	this.subject.getPublicCredentials().add((Object)username); 
-
44:	this.subject.getPrivateCredentials().add((Object)password); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
61:	loginModule.initialize(subject, callbackHandler, null, new HashMap()); 
-
140:	assertEquals("logout should have cleared Subject principals.", 0, subject.getPrincipals().size()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
41:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials
68:	Subject subject = new Subject(); 
-
70:	subject.getPrivateCredentials().add(cred); 
-
73:	subject.getPrincipals().add(nm); 
-
78:	subject.getPrincipals().add(nm); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
96:	Subject subject = new Subject(); 
-
100:	lm.initialize( subject, callbackHandler, null, options ); 
-
107:	Set roles = subject.getPrincipals(JAASRole.class); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
37:	// It is used in KerberosName#getShortName which is used in User constructor invoked by UserGroupInformation#getUGIFromSubject 
-
47:	 
48:	@Override 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
55:	Subject subject = new Subject(); 
-
71:	if (subject.getPrincipals().size() == 0) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials, getPublicCredentials, isReadOnly
85:	if(!subject.isReadOnly()) { 
-
87:	if(addOnPrincipal != null) subject.getPrincipals().remove(addOnPrincipal); 
88:	subject.getPrincipals().removeAll(krb5Subject.getPrincipals()); 
89:	subject.getPublicCredentials().removeAll(krb5Subject.getPublicCredentials()); 
90:	subject.getPrivateCredentials().removeAll(krb5Subject.getPrivateCredentials()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
41:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: doAs, getPrincipals, getPrivateCredentials
53:	Subject subj = new Subject(); 
-
57:	subj.getPrincipals().add(kp); 
58:	subj.getPrivateCredentials().add(kk); 
-
60:	Subject.doAs(subj, new PrivilegedExceptionAction() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: doAsPrivileged
45:	Subject.doAsPrivileged( 
46:	new Subject(true, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials
158:	module.initialize( 
-
165:	assertEquals(this.subject.getPrincipals().size(), 3); 
166:	assertEquals(TICKET, this.subject.getPrivateCredentials().iterator().next().toString()); 
-
170:	assertEquals(0, subject.getPrincipals().size()); 
171:	assertEquals(0, subject.getPrivateCredentials().size()); 
-
175:	module.initialize( 
-
187:	assertEquals(0, this.subject.getPrincipals().size()); 
188:	assertEquals(0, this.subject.getPrivateCredentials().size()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials, getPublicCredentials
38:	Subject subject = new Subject(); 
-
40:	return new Object[] { subject, subject.getPrincipals(), 
41:	subject.getPrivateCredentials(), subject.getPublicCredentials() }; 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
37:	Set<KerberosPrincipal> kerberosPrincipals = subject.getPrincipals(KerberosPrincipal.class); 
-
47:	subject.getPrincipals().add(user); 
48:	UserGroupInformation userGroupInformation = new UserGroupInformation(subject); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: doAsPrivileged, getPrincipals
39:	Subject s = new Subject(); 
40:	s.getPrincipals().add 
-
44:	Subject.doAsPrivileged(s, new PrivilegedAction() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
44:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
100:	Subject s = new Subject(); 
-
105:	assertFalse(s.getPrincipals().isEmpty()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
33:	Subject subject = new Subject(); 
-
38:	Set principals = subject.getPrincipals(); 
-
43:	ContextManager.registerSubject(subject); 
44:	Principal principal = ContextManager.getCurrentPrincipal(subject); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPrivateCredentials, getPublicCredentials, isReadOnly
94:	if(!subject.isReadOnly()) { 
95:	subject.getPrincipals().removeAll(wrapped); 
96:	subject.getPrincipals().removeAll(localSubject.getPrincipals()); 
97:	subject.getPrivateCredentials().removeAll(localSubject.getPrivateCredentials()); 
98:	subject.getPublicCredentials().removeAll(localSubject.getPublicCredentials()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
58:	Subject subject = new Subject(); 
-
60:	ManagedConnectionImpl conn = new ManagedConnectionImpl(mcf, cxRequestInfo, subject); 
-
62:	Object handle1 = conn.getConnection(subject, cxRequestInfo); 
63:	Object handle2 = conn.getConnection(subject, cxRequestInfo); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
86:	final Subject subject = new Subject(); 
87:	subject.getPrincipals().add(expected); 
88:	subject.getPrincipals().add(other); 
-
93:	 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, setReadOnly
34:	Subject subject = new Subject(); 
-
38:	subject.getPrincipals().add(new SimplePrincipal(name)); 
39:	subject.getPrincipals().add(new SimpleGroup("developers", name)); 
40:	subject.setReadOnly(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
47:	Subject subject = new Subject(); 
48:	subject.getPrincipals().add(token.getPrincipal()); 
-
50:	subject.getPrincipals().add(new SimpleGroup("manager", token.getUsername())); 
-
52:	subject.getPrincipals().add(new SimpleGroup("worker", token.getUsername())); 
53:	token.setSubject(subject); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
93:	ap.login(new Subject(), null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, getPublicCredentials, isReadOnly
95:	if (!subject.isReadOnly()) { 
96:	Set principals = subject 
-
98:	subject.getPrincipals().removeAll(principals); 
99:	Set creds = subject 
-
101:	subject.getPublicCredentials().removeAll(creds); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
44:	Set<Principal> principals = subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: doAs, getPrincipals, getPrivateCredentials
53:	Subject subj = new Subject(); 
-
57:	subj.getPrincipals().add(kp); 
58:	subj.getPrivateCredentials().add(kk); 
-
60:	Subject.doAs(subj, new PrivilegedExceptionAction() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, setReadOnly
35:	Subject subject = new Subject(); 
-
39:	subject.getPrincipals().add(new SimplePrincipal(name)); 
40:	subject.getPrincipals().add(new SimpleGroup(roleName, name)); 
41:	subject.setReadOnly(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
50:	Subject subject = new Subject(); 
51:	subject.getPrincipals().add(principal); 
-
53:	subject.getPrincipals().add(new SimpleGroup("manager", ut.getName())); 
-
55:	subject.getPrincipals().add(new SimpleGroup("worker", ut.getName())); 
56:	cred.setSubject(subject); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: doAs, getPrincipals, getPrivateCredentials
53:	Subject subj = new Subject(); 
-
57:	subj.getPrincipals().add(kp); 
58:	subj.getPrivateCredentials().add(kk); 
-
60:	Subject.doAs(subj, new PrivilegedExceptionAction() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
49:	public static final Subject ANONYMOUS_SUBJECT = new Subject(); 
-
52:	ANONYMOUS_SUBJECT.getPrincipals().add(ANONYMOUS_PRINCIPAL); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, setReadOnly
50:	Subject subject = new Subject(); 
-
55:	subject.getPrincipals().add(new SimplePrincipal(name)); 
-
59:	subject.getPrincipals().add(new SimpleGroup(roleName, name)); 
60:	subject.setReadOnly(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
78:	subject.getPrincipals().add(new UsernamePrincipal(username)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals, setReadOnly
38:	Subject subject = new Subject(); 
-
43:	subject.getPrincipals().add(new SimplePrincipal(name)); 
-
52:	subject.getPrincipals().add(new SimpleGroup(roleName, name)); 
53:	subject.setReadOnly(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
79:	assertTrue("Principals should contain the authentication", subject.getPrincipals().contains(auth)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
37:	return subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
37:	return subject.getPrincipals(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPrincipals
94:	subject.getPrincipals().add(authen); 
Full Snippet Info
6
CodeRank
See Code Examples for Java 8 Subject Methods: