Package javax.security.auth.login

Examples of javax.security.auth.login.CredentialNotFoundException


    /**
     * @tests javax.security.auth.login.CredentialNotFoundException#CredentialNotFoundException()
     */
    public final void testCtor1() {
        assertNull(new CredentialNotFoundException().getMessage());
    }
View Full Code Here


    /**
     * @tests javax.security.auth.login.CredentialNotFoundException#CredentialNotFoundException(
     *        java.lang.String)
     */
    public final void testCtor2() {
        assertNull(new CredentialNotFoundException(null).getMessage());

        String message = "";
        assertSame(message, new CredentialNotFoundException(message)
                .getMessage());

        message = "message";
        assertSame(message, new CredentialNotFoundException(message)
                .getMessage());
    }
View Full Code Here

public class CredentialNotFoundExceptionTest extends SerializationTest {

    @Override
    protected Object[] getData() {
        return new Object[] {new CredentialNotFoundException("message")};
    }
View Full Code Here

            throw new LoginException("No Tomcat realm available");
        }

        final Principal principal = realm.authenticate(username, password);
        if (principal == null) {
            throw new CredentialNotFoundException(username);
        }

        final Subject subject = createSubject(realm, principal);
        return registerSubject(subject);
    }
View Full Code Here

     */
    public synchronized void delete(String title, String reason) throws IOException, LoginException
    {
        long start = System.currentTimeMillis();
        if (user == null || !user.isAllowedTo("delete"))
            throw new CredentialNotFoundException("Cannot delete: Permission denied");

        // edit token
        HashMap info = getPageInfo(title);
        if (!(Boolean)info.get("exists"))
        {
View Full Code Here

     */
    public synchronized void undelete(String title, String reason, Revision... revisions) throws IOException, LoginException
    {
        long start = System.currentTimeMillis();
        if (user == null || !user.isAllowedTo("undelete"))
            throw new CredentialNotFoundException("Cannot undelete: Permission denied");

        // deleted revisions token
        String titleenc = URLEncoder.encode(normalize(title), "UTF-8");
        String delrev = query + "action=query&list=deletedrevs&drlimit=1&drprop=token&titles=" + titleenc;
        if (!delrev.contains("token=\"")) // nothing to undelete
View Full Code Here

    protected Revision[] deletedRevs(String u, String title, Calendar start, Calendar end, boolean reverse, int namespace)
            throws IOException, CredentialNotFoundException
            {
        // admin queries are annoying
        if (!user.isAllowedTo("deletedhistory"))
            throw new CredentialNotFoundException("Permission denied: not able to view deleted history");

        StringBuilder url = new StringBuilder(query);
        url.append("list=deletedrevs&drprop=revid%7Cparentid%7Clen%7Cminor%7Ccomment%7Cuser&drlimit=max");
        if (reverse)
            url.append("&drdir=newer");
View Full Code Here

     @since 0.30
     */
    public String[] deletedPrefixIndex(String prefix) throws IOException, CredentialNotFoundException
    {
        if (!user.isAllowedTo("deletedhistory") || !user.isAllowedTo("deletedtext"))
            throw new CredentialNotFoundException("Permission denied: not able to view deleted history or text.");

        StringBuilder url = new StringBuilder(query);
        url.append("list=deletedrevs&drprefix=");
        url.append(URLEncoder.encode(prefix, "UTF-8"));
        throw new UnsupportedOperationException("Not implemented yet.");
View Full Code Here

     @since 0.30
     */
    public String getDeletedText(String page) throws IOException, CredentialNotFoundException
    {
        if (!user.isAllowedTo("deletedhistory") || !user.isAllowedTo("deletedtext"))
            throw new CredentialNotFoundException("Permission denied: not able to view deleted history or text.");

        // TODO: this can be multiquery(?)
        StringBuilder url = new StringBuilder(query);
        url.append("list=deletedrevs&drlimit=1&drprop=content&titles=");
        url.append(URLEncoder.encode(page, "UTF-8"));
View Full Code Here

            {
        long start = System.currentTimeMillis();
        // check for log in
        if (user == null || !user.isAllowedTo("move"))
        {
            CredentialNotFoundException ex = new CredentialNotFoundException("Permission denied: cannot move pages.");
            log(Level.SEVERE, "move", "Cannot move - permission denied: " + ex);
            throw ex;
        }

        // check namespace
View Full Code Here

TOP

Related Classes of javax.security.auth.login.CredentialNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.